PDA

View Full Version : Extracting values from logs


pzabb6
11-06-2009, 23:51
Line in Log file

2009-06-11 05:58:43,687 INFO EIDCACHE - q=0 000776CEIDKEY 539599

is there any way of extracting the value 539599 from each line of the log so that i'd be able to set a trigger to alert if the value is greater than 700000?

Either using a regular expression or other solution?

Thanks

sirivias
19-06-2009, 00:48
1) Write a script to parse out the value you need, then have zabbix call that script.
something like
tail -n 20 log_file | grep "INFO EIDCACHE" | tail -n 1 | awk '{print $NF}'
Store this result in zabbix with whatever frequency you desire.
Set an alert when the last value > 70000

2)create your own log with just those values, and have zabbix monitor that log.

3)But best would be to create the key as a zabbix_sender key
then run a script that watches for the value you want - and calls zabbix_sender to send the data point to the server.