All Apps and Add-ons

Extract word using regex expression

nareshmg
New Member

team,
Need help to extract the appication name from the log string, from the below log statements, i need help to get only application name. like applicationName1,applicationName2,applicationName3 ....

the only fixed items is the position of the application name,

[06-19-2018 16:20:10.20][WARN][hostname1][txnName1][uniqueid1][applicationName1][username1][threadname1] ....
[06-19-2018 16:20:10.20][WARN][hostname][txnName2][uniqueid2][applicationName2][username2][threadname2] ....
[06-19-2018 16:20:10.20][WARN][hostname][txnName3][uniqueid3][applicationName3][username3][threadname3] ....
[06-19-2018 16:20:10.20][WARN][hostname][txnName4][uniqueid4][applicationName4][username4][threadname4] ....
[06-19-2018 16:20:10.20][WARN][hostname][txnName5][uniqueid5][applicationName5][username5][threadname5] ....
[06-19-2018 16:20:10.20][WARN][hostname][txnName6][uniqueid6][applicationName6][username6][threadname6] ....

0 Karma

richgalloway
SplunkTrust
SplunkTrust

regex101.com is a great site for trying out regular expressions against sample events to see what works best. Using that, I came up with (?:\[[^\]]*\]){5}\[(?<applicationName>[^\]]*). Try it out.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...