Page 1 of 1

how to shrink log files?!

Posted: Tue Oct 15, 2019 12:29 pm
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

Re: how to shrink log files?!

Posted: Tue Oct 15, 2019 12:33 pm
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

Re: how to shrink log files?!

Posted: Tue Oct 15, 2019 9:24 pm
by xpertech
what's the automatic rotate interval(size or time)?

Re: how to shrink log files?!

Posted: Wed Oct 16, 2019 6:25 am
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

Re: how to shrink log files?!

Posted: Wed Oct 16, 2019 9:34 am
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?

Re: how to shrink log files?!

Posted: Wed Oct 16, 2019 10:08 am
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.

Re: how to shrink log files?!

Posted: Wed Oct 16, 2019 10:31 am
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

Re: how to shrink log files?!

Posted: Wed Oct 16, 2019 10:58 am
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.