Hey Experts, I'm new to splunk and I'm trying to extract APP WEB and MNOPQ from a field called result. Can someone please guide me on how to achieve this? Any help or example queries would be greatly appreciated. Thank You!
Fi a:\abc\def\MNOPQ.txt content is expected to include "A H Dis Query,0,0"
Fi a:\abc\def\APP.txt content is expected to include "A H Dis Query,0,0"
Fi a:\abc\def\WEB.txt content is expected to include "A H Dis Query,0,0"
Hi @Muthu_Vinith ,
you should use a regex like the following:
| rex field=result "\w:\\\w+\\\w+\\(?<myfield>[^\.]+)"
that you can test at https://regex101.com/r/BYH1rP/1
Ciao.
Giuseppe
| rex field=result "\w:\\\\\w+\\\\\w+\\\\(?<myfield>[^\.]+)"
The above query extracts, but if i want to extract APP and WEB which is in same line how to extract ?
Fi a:\abc\def\MNOPQ.txt content is expected to include "A H Dis Query,0,0"
Fi a:\abc\def\APP.txt content is expected to include "A H Dis Query,0,0" Fi a:\abc\def\WEB.txt content is expected to include "A H Dis Query,0,0"
Fi a:\abc\def\SQL.txt content is expected to include "A H Dis Query,0,0"
Use max_match
| rex max_match=0 field=result "\w:\\\\\w+\\\\\w+\\\\(?<myfield>[^\.]+)"
Note that this will give you a multivalue field
Thanks @ITWhisperer
@Muthu_Vinith Please use descriptive title. This helps future users finding the answer.
Thanks!! @gcusello @ITWhisperer
Hi @Muthu_Vinith ,
good for you, see next time!
let us know if we can help you more, or, please, accept one answer for the other people of Community.
Ciao and happy splunking
Giuseppe
P.S.: Karma Points are appreciated by all the contributors 😉
| rex field=result "\w:\\\\\w+\\\\\w+\\\\(?<myfield>[^\.]+)"
Hi @Muthu_Vinith ,
you should use a regex like the following:
| rex field=result "\w:\\\w+\\\w+\\(?<myfield>[^\.]+)"
that you can test at https://regex101.com/r/BYH1rP/1
Ciao.
Giuseppe