-
-
Notifications
You must be signed in to change notification settings - Fork 875
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
Add stream log support #1461
Add stream log support #1461
Conversation
manifests/init.pp
Outdated
@@ -117,6 +119,7 @@ | |||
$keepalive_timeout = '65s', | |||
$keepalive_requests = '100', | |||
$log_format = {}, | |||
$stream_log_format = {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please enforce the datatype here as well. I guess something like this should work:
$stream_log_format = {}, | |
Hash[String[1], String[1]] $stream_log_format = {}, |
templates/conf.d/nginx.conf.erb
Outdated
@@ -326,5 +326,19 @@ stream { | |||
<% unless @confd_only -%> | |||
include <%= @conf_dir %>/streams-enabled/*; | |||
<% end -%> | |||
|
|||
<% if @stream_log_format -%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you test if the if statement is required? The variable always exists, by default it's just empty. I think we can directly start with the .sort_by call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What could make sense is
<% end -%>
<% unless @stream_log_format.empty? -%>
<% @stream_log_format.sort_by{|k,v| k}.each do |key,value| -%>
With this you can prevent the empty lines in the generated config. Because right now it generates (roughly):
include .../streams-enabled/*;
access_log ...
(note it's 2 empty lines instead of 1)
I am working on making updates to fix this PR. I need to check it works with what we have deployed. I think the tests are failing because they are in the wrong location in the test file. I think the test lines might be better in a context for Would it work adding a "dynamic module" test similar to geoip module, checking the geoip test example: puppet-nginx/spec/classes/nginx_spec.rb Line 1162 in fffe7a3
|
48f82a8
to
836de1d
Compare
836de1d
to
a2783a0
Compare
a2783a0
to
212f883
Compare
5fe5272
to
b075ef4
Compare
Updated with suggested changes |
From a quick look this looks good, but the tests fail. The CentOS 7 tests failing looks unrelated to me, but the unit tests do. |
Still the same issue with the unit tests. Which isn't surprising since I did a quick copy & paste to get started. I don't see anything that tests
And without that being set, it's not expected the lines get written to the config file, and the unit tests correctly fail. These tests might not cleanly fit within the existing template iterator. I will have another look |
b075ef4
to
bb4be27
Compare
2401983
to
fd7c84c
Compare
fd7c84c
to
8837d9b
Compare
@ekohl I have added a basic set of tests to cover the main use case for the stream access log. Appreciate if you could give another review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Pull Request (PR) description
Following on work from previous PRs to add stream log changes to the module.
Updated changes to fix file conflicts and newer changes in v4.1.0
The configuration in Hiera:
Adds the following lines to nginx.conf:
If
stream_custom_format_log
is not set, nginx will use the built-incombined
log format for the stream access log.This Pull Request (PR) fixes the following issue
Closes: #1439