lgcheckd -a ( start | stop | status )
lgcheckd -a ( defined | monitored )
lgcheckd -a ( [no]collect | [no]ifstart )
lgcheckd -a ( refresh | reset )
lgcheckd -a report
cat logfile | lgcpattern [ -s ] patternfile
cat logfile | lgcpattern -p
---
With lgcheckd 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.
Files listed in the LOGFILE OPTIONS section of the configuration file must not exist at start of the lgcheckd. However, as soon as such a file appears it is monitored.
The generated HTML 'Log File Check' report allows easy
navigation in the report and provides a view of all matched
log file entries per level of importance for a reporting period.
Only existing files or files that once existed during a
reporting period will be listed in the report.
The HTML report is also suited for viewing with the lynx(1) browser.
lgcheckd is able to communicate to other commands for each matched logfile entry via the INTERFACES mechanism, which can be configured in the lgcheckd.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.
lgcheckd
will not fill up the file system where the log data
is collected.
If file space gets short during log file analysis
the log file match data collection is suspended until
sufficient disk space is available again
(and will then resume automatically).
The suspension applies as soon as the free space is
lower then
20
times the current size of the
state.db,
whereas this number can be changed in the config file
using the
SUSPENDTRIGGER=number
setting.
During the suspension the log files are still analysed,
the matches are counted and the interfaces are started.
When invoking the report action, the current log collection run is ended, the log match data is deleted (depending on the CLEAN_COLLECT setting in the configuration file) and a new collection run is started.
All log files ever monitored are listed in the report.
However, if a log file has no matches in the current log collection run, '<no pattern matches>' is shown in the Logfiles section of the report.
When logfiles have matches, but during it's occurrence the log file match collection was suspended, the related match counts are shown in the Overview section of the report. In that case in the Logfiles section '<no data available>' is shown as long during the whole collect run duration no other matches were recorded.
The produced report file name is printed plain to stdout to allow easy capturing and further processing (as mailing the report using mail_file(1)).
When the lgcheckd experiences heavy load due to many log entries that have to be analysed, it switches temporarily from SINGLE to BURST write mode. Whereas in SINGLE mode match counts and log matches are immediately written to the database, in BURST mode the daemon delays writing to the database and then writes the information in larger junks to it. This to increase performance.
Therefore the information shown when using -a monitored is not up to date while the daemon is in BURST mode.
The interval of checking for new log files that appeared based on the definition in the configuration file is 5 minutes.
See lgcpattern(3) for more information.
The GENERAL OPTIONS options are loaded on daemon start, the LOGFILE OPTIONS options are loaded on daemon start and are re-evaluated in an interval of 300 seconds or when the lgcheckd -a refresh command is invoked.
The provided template file var/samples/templates/lgcheck.cfg contains the settings computed by the lgcheckd only and should be used as starting point for configuration of new setups if the legacy log checking daemon logcheckd was not used before.
If the file etc/lgcheckd.cfg does not exist the lgcheckd reads this file without disadvantages. However, the lgcheckd computes the leaner set of options as documented in lgcheckd.cfg(4).
See logcheckd.interface(3) for more information.
The needed pattern files are loaded on on daemon start and if changed re-loaded in an interval of 300 seconds or when the lgcheckd -a refresh command is invoked.
See logcheckd.pattern(3) for more information.
In the config file etc/lgcheckd.cfg the pattern file is specified *without* the <OSID> part. lgcheckd first checks if an 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.
See logcheckd.pattern(3) for more information.
See logcheckd.interface(3) for more information.
The report is also suited for viewing with the lynx(1) browser.
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 Log Check 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] .*
The complete pattern file:
[ /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]: lgcheckd -a start lgcheckd - a log file checking and reporting daemon, by Chr. Walther lgcheckd-INFO: start daemon.
[ /root ] [ root@acme001 ][-sh]: lgcheckd -a status lgcheckd - a log file checking and reporting daemon, by Chr. Walther lgcheckd-INFO: daemon is not running, collection is 'enabled', interfacestart is 'enabled'.
[ /root ] [ root@acme001 ][-sh]: lgcheckd -a report lgcheckd - a log file checking and reporting daemon, by Chr. Walther lgcheckd-INFO: create report for collect run '13'. lgcheckd-INFO: report file is '/opt/edrc/var/logcheckd/report/logcheck.acme001.20240817121518.html'. lgcheckd-INFO: collection match data for collect run '13' deleted. lgcheckd-INFO: active collect run is now '14'. done.
[ /root ] [ root@acme001 ][-sh]: lgcheckd -a stop lgcheckd - a log file checking and reporting daemon, by Chr. Walther lgcheckd-INFO: daemon not running.
[ /root ] [ root@acme001 ][-sh]: lgcheckd -a reset lgcheckd - a log file checking and reporting daemon, by Chr. Walther lgcheckd-INFO: daemon database initialized.
The lgcheckd can be started using edrcinit(1m), for which the service handler WA2Ledrc.lgcheckd is available.
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.