I want to make a usecase that will detect the usage of several destination port numbers. For this, I think it's easiest to use a regular expression. But I'm not sure. I'm also having trouble implementing a regular expression into my query. I've never worked with them before.
Please evaluate the following information and tell me what you think is best to develop the query.
Now, for what I've tried is the following:
index=network
| regex dest_port>="688[1-9]"
But this doesn't work. I will use datamodel later.
The range for the ports is:
In addition to those ports, we also want it to alert when it finds the following strings in the field app_category:
Any help would be much appreciated. I think someone with a lot of regular expression experience will be able to make the query easily, I've been stuck on it for hours sadly and I would love some help.
Thanks!
Like this (breaks down at 1000 values):
index=network [ |makeresults | eval port=mvappend(mvrange(6881, 6889, 1), "6969") | format ]
Do NOT use regex
because it does not map-reduce and you will pull all the values out only to throw them away and your search will take 1000x longer than the way that I just showed you.
@kokanne ,
For the dest_port, try
index=network | regex dest_port="688[1-9]|6969"
and for the app_category, you could search with (app_category="*tracker*" OR app_category="*torrent*")
Or if both conditions are to be matched , try
index=network |where (match(dest_port,"688[1-9]|6969") OR match(app_category,"tracker|torrent"))