Skip to content
This repository has been archived by the owner on Jan 9, 2021. It is now read-only.

Commit

Permalink
[COOK-3428] Disable logging when disable_access_log is true
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Wright authored and sethvargo committed Sep 10, 2013
1 parent 00d4967 commit 2b0736f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ config file.
value of `server_names_hash_bucket_size`.
* `node['nginx']['disable_access_log']` - set to true to disable the
general access log, may be useful on high traffic sites.
* `node['nginx']['access_log_options']` - Set to a string of additional options
to be appended to the access log directive
* `node['nginx']['error_log_options']` - Set to a string of additional options
to be appended to the error log directive
* `node['nginx']['default_site_enabled']` - enable the default site
* `node['nginx']['sendfile']` - Whether to use `sendfile`. Defaults to "on".
* `node['nginx']['install_method']` - Whether nginx is installed from
Expand Down
2 changes: 2 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@
default['nginx']['server_names_hash_bucket_size'] = 64
default['nginx']['sendfile'] = 'on'

default['nginx']['access_log_options'] = nil
default['nginx']['error_log_options'] = nil
default['nginx']['disable_access_log'] = false
default['nginx']['install_method'] = 'package'
default['nginx']['default_site_enabled'] = true
Expand Down
8 changes: 5 additions & 3 deletions templates/default/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ daemon off;
worker_rlimit_nofile <%= node['nginx']['worker_rlimit_nofile'] %>;
<% end -%>

error_log <%= node['nginx']['log_dir'] %>/error.log;
error_log <%= node['nginx']['log_dir'] %>/error.log<% if node['nginx']['error_log_options'] %> <%= node['nginx']['error_log_options'] %><% end %>;
pid <%= node['nginx']['pid'] %>;

events {
Expand All @@ -28,8 +28,10 @@ http {
include <%= node['nginx']['dir'] %>/mime.types;
default_type application/octet-stream;

<% unless node['nginx']['disable_access_log'] -%>
access_log <%= node['nginx']['log_dir'] %>/access.log;
<% if node['nginx']['disable_access_log'] -%>
access_log off;
<% else -%>
access_log <%= node['nginx']['log_dir'] %>/access.log<% if node['nginx']['access_log_options'] %> <%= node['nginx']['access_log_options'] %><% end %>;
<% end %>
<% if node['nginx']['server_tokens'] -%>
server_tokens <%= node['nginx']['server_tokens'] %>;
Expand Down

0 comments on commit 2b0736f

Please sign in to comment.