Mathew Davies home

Nginx Logwatch Configuration

My installation of logwatch did not detect I was running Nginx and thus did not create the configuration files for me. Here is how I fixed that:

This will only work if you use the combined access log format. Create the following file:

/usr/share/logwatch/dist.conf/logfiles/http.conf

and insert the data below:

LogFile = /usr/local/nginx/logs/access.log
Archive = /home/website/logs/old/access.*.log.*.gz

# Expand the repeats (actually just removes them now)
*ExpandRepeats

# Keep only the lines in the proper date range...
*ApplyhttpDate

Hopefully that helped someone out.

Discuss on Reddit or Hacker News.