How to get the Log file name that we are monitoring using Zabbix

log-filesloggingzabbixzabbix-agent

I am trying to get the log file's name that we are monitoring using zabbix.
Is there a way to do this?

I created one item in zabbix to monitor log file like this:
logrt["/var/logs/error_[0-9]{1,3}.log","Critical"]

When it fetches data, it gives me the exact row but I want to know from which file that data came as I am monitoring multiple error log files.

Best Answer

I will do it in a different t way, creating custom low level discovery rules.

The idea is to have a discovery rule that lists all the available log files and a rule that creates Zabbix items/triggers/graphs... based on the output of the discovery.

The discovery runs every n seconds so you will end up automating the creation and even the deletion of log items if needed. It is used for full monitoring discovery and automation!

See the Zabbix documentation:

https://www.zabbix.com/documentation/current/manual/discovery/low_level_discovery