Showing posts with label Logs. Show all posts
Showing posts with label Logs. Show all posts

Friday, August 12, 2011

Analysing logs in Linux

Part of the security and sysadmins tasks is the log analysis and decision taking. There is plenty of information in http://www.linux.org/apps/all/Administration/Log_Analyzers.html.

The tools i recommend is called "Lire", this tool permits the creation of several reporting formats, including html, pdf, xml, between others. It also permits to analyze many log file formats, which include MySQL, Iptables, BIND, Apache, Qmail, Postfix, Syslog and more. Lire is GPL'ed Free Software (and Open Source), built around the idea of extendibility.

This tool is available from http://www.logreport.org/lire, it has been deveploped in Perl and i recommend you to install all the dependence modules with CPAN (type "perl -M CPAN -e shell" on the command line as root).

Saturday, August 14, 2010

Delete old log files in Linux

Here is the quick command to delete the log files which are older than specified time in Linux

Be careful as these are powerful commands which blow away files completely.
  

Note: 
To find files modified more than 5 days use -mtime +5 and files modified less than 5 days use -mtime -5

Use -ctime parameter to find out the created time

To List and Delete log files older than 10 days, execute the following commands
 

find /var/log/ -name *.log -mtime +10 -exec ls -tl {} \; 
find /var/log/ -name *.log -mtime +10 -exec rm -f {} \;

By Suresh : rm -rf *.[0-9]