[ZBXNEXT-481] possibility to specify several regular expressions in an item Created: 2010 Aug 19  Updated: 2016 Dec 22

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: Agent (G), Server (S)
Affects Version/s: None
Fix Version/s: None

Type: Change Request Priority: Minor
Reporter: Aleksandrs Saveljevs Assignee: Unassigned
Resolution: Unresolved Votes: 4
Labels: globalregexps, items, regexps
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Suppose we wish to monitor Web server log files and we have three requirements:

(1) we do not want to see accesses from our own IPs (e.g., 12.34.56.78, 34.56.78.12, and 56.78.12.34);
(2) we do not want to see particular domains (e.g., test1.example.com, test2.example.com, and test3.example.com);
(3) we wish to see lines that contain all of "aaa", "bbb", and "ccc".

Currently, the only reasonable way to do this is to create a single big regular expression (e.g., MY_BIG_REGEXP) in "Administrator" -> "General" -> "Regular expressions" and then specify this regular expression in an item, like so:

log[mylogfile.txt,@MY_BIG_REGEXP]

This sometimes lacks flexibility, which is highly inconvenient. Suppose there is a file hislogfile.txt. We wish to (1) exclude IP addresses 12.34.56.78, 34.56.78.12, and 56.78.12.34 as before, (2) exclude different domains this time: demo1.example.com, demo2.example.com, and demo3.example.com, (3) see lines that contain "aaa", "bbb", and "ccc" as before. And if there is also herlogfile.txt, in which we wish to do (1) and (2) as in the second case, but instead of (3) we wish to see "xxx", "yyy", and "zzz", this leads to three big regular expressions that have a lot of duplicate information.

What would be highly cool to do, is create five regular expressions:

(1) NOT_OUR_IPS, which excludes our IP addresses;
(2) NOT_TEST_DNS, which excludes testX.example.com;
(3) NOT_DEMO_DNS, which excludes demoX.example.com;
(4) AAA_BBB_CCC for "aaa", "bbb", and "ccc";
(5) XXX_YYY_ZZZ for "xxx', "yyy", and "zzz".

We could then combine them in different ways, like so:

log[mylogfile.txt,@NOT_OUR_IPS@NOT_TEST_DNS@AAA_BBB_CCC]
log[hislogfile.txt,@NOT_OUR_IPS@NOT_DEMO_DNS@AAA_BBB_CCC]
log[herlogfile.txt,@NOT_OUR_IPS@NOT_DEMO_DNS@XXX_YYY_ZZZ]

This is vastly more flexible and convenient than having to create big regular expressions that have duplicate information. For instance, if we get a new IP address (e.g., 78.12.34.56), we only have to add it to NOT_OUR_IPS, rather than all big regular expressions.



 Comments   
Comment by Glebs Ivanovskis (Inactive) [ 2016 Dec 22 ]

Since the result of matching or not matching global regular expression is basically a boolean, even more flexibility would be achieved if logical operators and parentheses were allowed.

Generated at Fri Apr 26 21:24:03 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.