Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom stream_log not properly defined #1551

Open
3rwan opened this issue May 22, 2023 · 1 comment · May be fixed by #1552
Open

custom stream_log not properly defined #1551

3rwan opened this issue May 22, 2023 · 1 comment · May be fixed by #1552

Comments

@3rwan
Copy link

3rwan commented May 22, 2023

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: v7.24.0
  • Ruby: 2.5.9p229
  • Distribution: Debian 11
  • Module version: 4.4.0

How to reproduce (e.g Puppet code you use)

Hiera code declaration for our custom nginx configuration

custom_nginx::config:
  stream: true
  map_hash_bucket_size: 128
  log_format:
    combined_lb: '[$time_local] TO:$http_host:$server_port FROM:$remote_addr:$remote_port BALANCED_TO:$upstream_addr REQ:"$request" $status upstream_resp_time:$upstream_response_time "$http_referer" "$http_user_agent" $remote_user'
    combined_lb_ssl: '[$time_local] TO:$http_host:$server_port FROM:$remote_addr:$remote_port WITH:$ssl_protocol/$ssl_cipher BALANCED_TO:$upstream_addr REQ:"$request" $status upstream_resp_time:$upstream_response_time "$http_referer" "$http_user_agent" $remote_user'
  stream_log_format:
    stream_combined_lb: '$remote_addr [$time_local] $protocol $status $bytes_sent $bytes_received $session_time "$upstream_addr" "$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"'

the code used on our custom puppet module

  class { 'nginx':
    manage_repo            => $manage_repo,
    package_source         => $package_source,
    package_name           => $package_name,
    package_ensure         => $package_ensure,
    service_name           => $service_name,
    server_purge           => $server_purge,
    confd_purge            => $confd_purge,
    log_format             => $log_format,
    stream_log_format      => $stream_log_format,
    server_tokens          => 'off',
    worker_connections     => $worker_connections,
    worker_rlimit_nofile   => $worker_rlimit_nofile,
    http_raw_prepend       => $http_raw_prepend,
    names_hash_bucket_size => $map_hash_bucket_size,
    stream                 => $stream,
  }

What are you seeing

on the configuration file for nginx

stream {
  include /etc/nginx/conf.stream.d/*.conf;
  include /etc/nginx/streams-enabled/*;

  log_format stream_combined_lb '$remote_addr [$time_local] $protocol $status $bytes_sent $bytes_received $session_time "$upstream_addr" "$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';

  access_log /var/log/nginx/stream-access.log;
}

What behaviour did you expect instead

on the configuration file for nginx

stream {

  log_format stream_combined_lb '$remote_addr [$time_local] $protocol $status $bytes_sent $bytes_received $session_time "$upstream_addr" "$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';

  access_log off;

  include /etc/nginx/conf.stream.d/*.conf;
  include /etc/nginx/streams-enabled/*;
}

Output log

when testing the nginx configuration file

sandbox-lb1-dev-rbx ~ # nginx -t
nginx: [emerg] unknown log format "stream_combined_lb" in /etc/nginx/streams-enabled/my_stream_config_file:5
nginx: configuration file /etc/nginx/nginx.conf test failed
sandbox-lb1-dev-rbx ~ #
@3rwan 3rwan linked a pull request May 22, 2023 that will close this issue
@3rwan
Copy link
Author

3rwan commented Jun 12, 2023

up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant