Disk space filling with apache logs

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
stebbo
Posts: 75
Joined: Sat Aug 04, 2012 9:13 pm

Disk space filling with apache logs

Post by stebbo »

Hi All,

I've been getting warnings from the localhost system regarding the falling amount of free space on my system. I only have an 8GB hard drive, and a little bit of exploring shows me that I have 2.6GB taken up by the apache log files in /var/log/httpd

How can I reduce the size of these log files? The system appears to be keeping the last 4 week's worth of log files in addition to the current file, each around 500-700MB in size.

Thanks in advance,
Chris.
Last edited by stebbo on Wed Aug 27, 2014 5:04 pm, edited 1 time in total.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Disk space filling with apache logs

Post by abrist »

What is in those log files? I bet there are a few lines that repeat ad nauseam. Could you take a look at the logs and post any oft-repeated lines?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
stebbo
Posts: 75
Joined: Sat Aug 04, 2012 9:13 pm

Re: Disk space filling with apache logs

Post by stebbo »

Hi abrist,

there are lots of lines that are very similar. many like

Code: Select all

10.174.64.33 - - [17/Aug/2014:03:04:03 +1000] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_service_status_state_summary_html%22%2C%22args%22%3A%7B%22hostname%22%3A%22localhost%22%2C%22servicename%22%3A%22Root%2BPartition%22%2C%22service_id%22%3A%2291%22%2C%22display%22%3A%22simple%22%7D%7D&nsp=b27d5f7810e119ffb956ba77ac197952 HTTP/1.1" 200 364 "http://nagios.lilydalehs.vic.edu.au:8080/nagiosxi/includes/components/xicore/status.php?show=servicedetail&host=localhost&service=Root+Partition" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0"
and more like

Code: Select all

10.174.64.182 - - [17/Aug/2014:03:04:08 +1000] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_host_status_attributes_html%22%2C%22args%22%3A%7B%22hostname%22%3A%22Library+Kiosk%22%2C%22host_id%22%3A%22268%22%2C%22display%22%3A%22all%22%7D%7D&nsp=4ad18112156a9a4ccf8d2985151b056d HTTP/1.1" 200 2405 "http://nagios/nagiosxi/includes/components/xicore/status.php?show=hostdetail&host=Library+Kiosk" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36"
I gather this is logging every single request - come to think of it I have a few machines around the place continually logged in on my dashboard page which is a minemap of the entire installation. from the above it seems every refresh of each of the couple of hundred green/red lights is logged?

Cheers,
Chris.
stebbo
Posts: 75
Joined: Sat Aug 04, 2012 9:13 pm

Re: Disk space filling with apache logs

Post by stebbo »

I'm thinking I can probably just turn off these logs and turn them back on again if I'm interested in looking at them in the future.

How might I go about turning off logging to the access_log files?

Cheers,
Chris.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Disk space filling with apache logs

Post by sreinhardt »

I would personally suggest setting up a 5-7 day log rotate instead, but if you really wish to disable them entirely. You are going to want to modify /etc/httpd/conf/httpd.conf and look for the CustomLog and ErrorLog directives. Simply commenting them out with # first should do the trick after an apache restart.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
stebbo
Posts: 75
Joined: Sat Aug 04, 2012 9:13 pm

Re: Disk space filling with apache logs

Post by stebbo »

Hi sreinhardt,

thanks for the response. I I'll look into log rotate. For the moment I've lowered the logging level to error rather than warning and will see what that produces.

Cheers,
Chris.
Locked