logcheckd -a ( start | stop | report | reset | status | defined | monitored )
cat logfile | logcheckd -a verify patternfile check_levels
---
With logcheckd logfiles can be analyzed and the content can be classified to different levels of importance.
During analysis the timestamp when a certain log entry has been discovered is added to the collected analysis output.
The levels used to classify the logfile content can be defined in pattern files which are related to one or more logfiles to be analyzed.
The generated HTML report allows easy navigation in the report and provides an index of the number of selected rows (=hits) per level of importance in an overview section of the report.
To allow judgement of the number of hits the absolute number of hits are also normalized to 'hits per day' (hits/day) which then are less dependent of the reporting period and can be compared to the hits/day of the last analysis period and a calculated hits trend.
The trend is calculated as:
trend_new = ( 0.75 * trend_last ) + ( 0.25 * hits_last )This means that the past goes into the trend calculation with tree quarts and the last run goes into the trend with a weight of one quart. This causes to approach a good prediction of expected future logfile content hits.
The generated report can be kept on the file system, but the main purpose is to
send it per mail to system administration personnel which will get a good
overview of the log situation on the system.
For compliance the report contains a random compliance code that is used to prove
that the report has been viewed. To help the administrative personnel and to enable
a consistent compliance procedure the generated report provides a
'send report view confirmation mail'
hyperlink that prepares a compliance mail when clicking on it having the compliance
code in the the subject line. So in the mailbox it is easy to see which reports
have been viewed by sorting it by subject.
logcheckd will not fill up the file system where the log data is collected and reported. If file space will be short during log file analysis the analysis is suspended until sufficient disk space is available again and will then resume automatically. A report will also only be generated if sufficient free space is available. The following suspension criteria applies:
{1.5 * lsize} > {available - (available + used)/100 * MIN_FREESPACE}For a logfile analysis, the "lsize" is the total size of the logfile to be analyzed; for a report creation, the "lsize" is the size of all collected matches of the collect run for which the report should be generated.
logcheckd is also able to communicate to other commands for each matched logfile entry via the INTERFACES mechanism, which can be configured in the logcheckd.cfg configuration file. Using interfaces, it is therefore possible to forward discovered matches to a monitoring system that might not have a very sophisticated logfile analysis functionality.
In the config file etc/logcheckd.cfg the pattern file is specified *without* the <OSID> part. logcheckd first checks if a operating system dependent pattern file exists and then uses the non-operating system dependent pattern file. This eases up configuration and enables to have identical configuration files across different operating systems.
In this example the logfile of su(1) command which allows to switch the user is checked. su writes successful user switches in the logfile as:
SU 06/05 11:03 + ta barney-root
unsuccessful attempts are logged as:
SU 06/05 11:03 - ta barney-root
The LogCheck report in this example should exclude all successful switches of the root user to any user, due to the fact that we trust the root user:
[EXCLUDE] .* + .* root-.*$
Non-successful tries to switch to the root user are classified to the HIGH section:
[HIGH] .* - .*-root$
Successful switches to root are classified as MEDIUM because the user doing the switch knows the password and the assumption here is, that the user knows this password by purpose:
[MEDIUM] .* + .*-root$
Non-successful switches to other users as root are also classified as MEDIUM due to the fact that the abuse of a non-root user has less impact as the abuse of the root user, but it also might be a brute force attack to get access to a user login:
.* -
All remaining entries are classified to the VERIFY section:
[VERIFY] .*
Later when running logcheckd as daemon the VERIFY and EXCLUDE sections will only be collected/reported when they are listed in the CHECK_LEVELS setting (e.g: CHECK_LEVELS=HIGH,MEDIUM,LOW,VERIFY,EXCLUDE ) in the config file logcheckd.cfg(4).
[ /root ] [ root@acme001 ][-sh]: cat -n /opt/edrc/var/logcheckd/pattern/su 01 # 02 # logcheckd/pattern/su - logfile analysis pattern file for: su 03 # 04 # [00] 25.04.2008 CWa Initial Version 05 # 06 07 [EXCLUDE] 08 09 .* + .* root-.*$ 10 11 [HIGH] 12 13 .* - .*-root$ 14 15 [MEDIUM] 16 17 .* + .*-root$ 18 .* - 19 20 [LOW] 21 22 23 24 [VERIFY] 25 26 .*
[ /root ] [ root@acme001 ][-sh]: tail -16 /var/adm/sulog | \ ~edrc/bin/logcheckd -a verify su EXCLUDE,HIGH,MEDIUM,LOW,VERIFY logcheckd - a log file checking and reporting daemon, by Chr. Walther verify patternfile '/opt/edrc/var/logcheckd/pattern/su' ... [EXCLUDE] 009| SU 06/05 11:00 + tty?? root-oracle 009| SU 06/05 11:01 + tty?? root-edrc 009| SU 06/05 11:01 + tty?? root-edrc 009| SU 06/05 12:00 + tty?? root-oracle 009| SU 06/05 12:00 + tty?? root-oracle 009| SU 06/05 12:00 + tty?? root-oracle 009| SU 06/05 12:00 + tty?? root-oracle 009| SU 06/05 12:02 + tty?? root-edrc 009| SU 06/05 12:02 + tty?? root-edrc 009| SU 06/05 12:02 + tty?? root-edrc (10) [HIGH] 013| SU 06/05 11:03 - ta barney-root (1) [MEDIUM] 018| SU 06/05 11:02 - ta barney-fred 017| SU 06/05 11:03 + ta barney-root 017| SU 06/05 11:32 + tc barney-root 017| SU 06/05 11:33 + 2 fred-root (4) [LOW] (0) [VERIFY] 026| SU 06/05 11:40 + ta barney-fred (1) ignored (0) done.
[ /root ] [ root@acme001 ][-sh]: logcheckd -a start logcheckd - a log file checking and reporting daemon, by Chr. Walther start logcheckd daemon ...(PID=23757)... done.
[ /root ] [ root@acme001 ][-sh]: logcheckd -a status logcheckd - a log file checking and reporting daemon, by Chr. Walther logcheckd daemon status ...(running,PID=23757,revision=33,collectrun=5)... done.
[ /root ] [ root@acme001 ][-sh]: logcheckd -a report logcheckd - a log file checking and reporting daemon, by Chr. Walther create report ... report information ... Customer ....... : WA2L Report ID ...... : acme001_10000 Report Period .. : 2008-06-25 15:20:00 - 2008-06-29 00:39:48 (292788 seconds) Send to ........ : admin@acme.ch Collect Run .... : 5 done. write report ... header section ... done. general section ... done. overview section ... done. logfile section ... done. foot section ... done. done. send report ... done. clear collect directory ... done. clear report ... done. done.
[ /root ] [ root@acme001 ][-sh]: logcheckd -a stop logcheckd - a log file checking and reporting daemon, by Chr. Walther stop logcheckd daemon ... send logcheckd daemon the stop signal ... done. wait for daemon to stop .... done. done.
[ /root ] [ root@acme001 ][-sh]: logcheckd -a reset logcheckd - a log file checking and reporting daemon, by Chr. Walther initialize logcheckd daemon ... clear state information ...... done. clear collect data ...... done. clear saved reports ...... done. done.
This is free software; see edrc/doc/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.