Log files can be a valuable source of information. Zabbix provides a way to monitor log files using the Zabbix agent. For that, two special keys are provided:
log
: Allows us to monitor a single filelogrt
: Allows us to monitor multiple, rotated files
Both of the log monitoring item keys only work as active items. To see how this functions, let's try out the Zabbix log file monitoring by actually monitoring some files.
Let's start with the simpler case, monitoring a single file. To do so, we could create a couple of test files. To keep things a bit organized, let's create a directory /tmp/zabbix_logmon/
on A test host
and create two files in there, logfile1
and logfile2
. For both files, use the same content as this:
2016-08-13 13:01:03 a log entry 2016-08-13 13:02:04 second log entry 2016-08-13 13:03:05 third log entry
Tip
Active items must be properly configured for log monitoring to work—we did that in Chapter 3, Monitoring with Zabbix Agents and...