how to shrink log files?!

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
xpertech
Posts: 399
Joined: Thu Sep 01, 2011 9:47 pm

how to shrink log files?!

Post by xpertech »

the log files seem getting bigger, is it possible to shrink the log files? or delete/remove older than specific date

-rw-r--r--. 1 nagios nagios 11011641755 Oct 15 11:23 event_handler.log
-rw-r--r--. 1 nagios nagios 6206885128 Oct 15 11:23 eventman.log
-rw-r--r--. 1 nagios nagios 5687960481 Oct 15 11:23 sysstat.log
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: how to shrink log files?!

Post by scottwilkerson »

Depending on your version of XI these should rotate automatically, but there isn't anything in them except debug information so you can safely do the following

Code: Select all

cat /dev/null > /usr/local/nagiosxi/var/event_handler.log
cat /dev/null > /usr/local/nagiosxi/var/eventman.log
cat /dev/null > /usr/local/nagiosxi/var/sysstat.log
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
xpertech
Posts: 399
Joined: Thu Sep 01, 2011 9:47 pm

Re: how to shrink log files?!

Post by xpertech »

what's the automatic rotate interval(size or time)?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: how to shrink log files?!

Post by scottwilkerson »

xpertech wrote:what's the automatic rotate interval(size or time)?
It's supposed to be 5M

Code: Select all

/etc/logrotate.d/nagiosxi
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
xpertech
Posts: 399
Joined: Thu Sep 01, 2011 9:47 pm

Re: how to shrink log files?!

Post by xpertech »

do you mean every 5 minutes the newly log data will overwrite old log data?

can we edit/change the rotate time interval?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: how to shrink log files?!

Post by scottwilkerson »

xpertech wrote:do you mean every 5 minutes the newly log data will overwrite old log data?
Sorry, every 5MB (which in your case clearly isn't happening)
xpertech wrote:can we edit/change the rotate time interval?
Yes, XI uses the linux log rotation and the config can be found here

Code: Select all

/etc/logrotate.d/nagiosxi


It is worth pointing out there were some bugs in this and if you are not on the latest version of XI (5.6.7) you could be experiencing that.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
xpertech
Posts: 399
Joined: Thu Sep 01, 2011 9:47 pm

Re: how to shrink log files?!

Post by xpertech »

if rotate every 5MB automatically, why log files oversize in my case?

-rw-r--r--. 1 nagios nagios 11011641755 Oct 15 11:23 event_handler.log
-rw-r--r--. 1 nagios nagios 6206885128 Oct 15 11:23 eventman.log
-rw-r--r--. 1 nagios nagios 5687960481 Oct 15 11:23 sysstat.log
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: how to shrink log files?!

Post by scottwilkerson »

xpertech wrote:It is worth pointing out there were some bugs in this and if you are not on the latest version of XI (5.6.7) you could be experiencing that.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked