log & audit file to truncate from top

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
zaji_nms
Posts: 616
Joined: Tue Oct 16, 2012 12:28 am

log & audit file to truncate from top

Post by zaji_nms »

Dear Experts

While checking found /var/log/mrtg.log is more than 5GB.

Also found same way /usr/local/nagvis/var/nagvis-audit.log (more than 17GB)

We do not want very old log (more than year or 6 months).

Please let us know any other such log files, we can truncate manually.

Please let us know how to truncate from top (need to remove old log)?
Is it safe to removed old log from this file?
No any adverse effect?

Regards
Zajil NMS
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: log & audit file to truncate from top

Post by Box293 »

What version of Nagios XI are you running?

Normally mrtg does not create a /var/log/mrtg.cfg file. Can you please run these commands and post the output:

Code: Select all

cat /etc/cron.d/mrtg

cat /etc/mrtg/mrtg.cfg
This should help identify why the file is being created. It is safe to delete, we just need to find out how it's being created.

As for NagVis, please refer to the config file /usr/local/nagvis/etc/nagvis.ini.php
I believe the setting you need is

Code: Select all

audit_log=0
This will turn off the audit logging.
I could not see an option for log rotation or max log size. I suggest you look at the NagVis support options available http://www.nagvis.org/free-support

If you want to remove the start of a file, simply tail the last x lines of the file to a new file, delete the old file and rename the new file.

Code: Select all

tail -n 1000 /usr/local/nagvis/var/nagvis-audit.log > /usr/local/nagvis/var/nagvis-audit.log.new
rm -f /usr/local/nagvis/var/nagvis-audit.log
mv /usr/local/nagvis/var/nagvis-audit.log.new /usr/local/nagvis/var/nagvis-audit.log
zaji_nms wrote:Is it safe to removed old log from this file?
Yes.
zaji_nms wrote:No any adverse effect?
You will no longer have access to the old contents once you remove them.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
zaji_nms
Posts: 616
Joined: Tue Oct 16, 2012 12:28 am

Re: log & audit file to truncate from top

Post by zaji_nms »

Thanks Mr.Troy for the reply and guidance.

Yes we still using /etc/mrtg/mrtg.cfg as we manually adding MRTG.

You can close the case.

Regards
Zajil NMS
Locked