<commit_before>apt_repository "nginx" do
  uri "http://ppa.launchpad.net/nginx/development/ubuntu"
  distribution node['lsb']['codename']
  components ["main"]
  keyserver "key<EMAIL>.ubuntu.<EMAIL>"
  key "C300EE8C"
end

if node['cxn']['logging'] then
    node.set['nginx']['access_log'] = [
      '/var/log/nginx/access.log acc_log',
      "syslog:server=#{node['rsyslog']['host']}:#{node['rsyslog']['port']} acc_log"
    ]
else
    node.set['nginx']['access_log'] = [
      '/var/log/nginx/access.log acc_log'
    ]
end

include_recipe 'nginx'

package 'nginx-extras' do
  notifies :reload, 'service[nginx]'
end

template "#{node['nginx']['dir']}/sites-enabled/00-purger" do
  source 'nginx/purgers.conf.erb'
  notifies :reload, 'service[nginx]'
  variables(
    varnish_address:     'localhost',
    varnish_port:        node['varnish']['listen_port'],
    purgers:             node['cxn']['purgers'].values + node['cxn']['nodes'].values
  )
end

logrotate_app 'nginx' do
  cookbook  'logrotate'
  frequency 'hourly'
  path      '/var/log/nginx/*.log'
  options   ['missingok', 'delaycompress', 'notifempty', 'sharedscripts']
  create    '0640 www-data adm'
  rotate    50
  su        'root'
  size      '50M'
  postrotate 'invoke-rc.d nginx rotate >/dev/null 2>&1'
  prerotate <<-EOF
  if [ -d /etc/logrotate.d/httpd-prerotate ]; then \\
      run-parts /etc/logrotate.d/httpd-prerotate; \\
    fi \\
EOF
end
<commit_msg>Fixing postrotate script not working - Removing delaycompress - Shorting amount of logs saved<commit_after>apt_repository "nginx" do
  uri "http://ppa.launchpad.net/nginx/development/ubuntu"
  distribution node['lsb']['codename']
  components ["main"]
  keyserver "keyserver.ubuntu.<EMAIL>"
  key "C300EE8C"
end

if node['cxn']['logging'] then
    node.set['nginx']['access_log'] = [
      '/var/log/nginx/access.log acc_log',
      "syslog:server=#{node['rsyslog']['host']}:#{node['rsyslog']['port']} acc_log"
    ]
else
    node.set['nginx']['access_log'] = [
      '/var/log/nginx/access.log acc_log'
    ]
end

include_recipe 'nginx'

package 'nginx-extras' do
  notifies :reload, 'service[nginx]'
end

template "#{node['nginx']['dir']}/sites-enabled/00-purger" do
  source 'nginx/purgers.conf.erb'
  notifies :reload, 'service[nginx]'
  variables(
    varnish_address:     'localhost',
    varnish_port:        node['varnish']['listen_port'],
    purgers:             node['cxn']['purgers'].values + node['cxn']['nodes'].values
  )
end

logrotate_app 'nginx' do
  cookbook  'logrotate'
  frequency 'hourly'
  path      '/var/log/nginx/*.log'
  options   ['missingok', 'notifempty', 'sharedscripts']
  create    '0640 www-data adm'
  rotate    30
  su        'root'
  size      '50M'
  postrotate '[ -s /run/nginx.pid ] && kill -USR1 `cat /run/nginx.pid`'
  prerotate <<-EOF
  if [ -d /etc/logrotate.d/httpd-prerotate ]; then \\
      run-parts /etc/logrotate.d/httpd-prerotate; \\
    fi \\
EOF
end

{'fraction_non_alphanumeric': 0.17474402730375427, 'fraction_numerical': 0.010580204778156996, 'mean_word_length': 3.4341906202723145, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5853430', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1068, 'n_words': 199}