Splunk Search

rex extraction user & module

indeed_2000
Motivator
Hi
Here is my log, what is the rex for extract "0000A0@#0000" and "mymodulename"
 
2021-07-14 23:59:05,185 INFO [APP] User: 0000A0@#0000 || module: mymodulename
 
any idea?
Thanks
 
Labels (3)
0 Karma
1 Solution

venkatasri
SplunkTrust
SplunkTrust

@indeed_2000 This one works for method. 

<your_search>
| rex "User\:\s+(?<user>\S+)\s+\|\|\s+method:\s+(?<method>\S+)$" 
| table user method

--

An upvote would be appreciated and accept solution if this reply helps!

View solution in original post

venkatasri
SplunkTrust
SplunkTrust

Hi @indeed_2000 

Can you try this?  

 

<your_search_goes_here> 
| rex "User\:\s+(?<user>\S+)\s\|\|\smodule\:\s+(?<module>.+)$" 
| table user module 

 

---

An upvote would be appreciated and Accept the solution if this reply helps!

 

Tags (1)
0 Karma

efika
Communicator

rex "User\:(?<user>.+)\s\|\|\smodule\:(?<module>.+)"

(field=_raw is added by default)

0 Karma

indeed_2000
Motivator

thank you for answer, it's not work on all user & module name (both might have capital word or special character)

e.g. 

2021-07-14 23:53:23,353 INFO [APP] User: A0000@#0000 || module: setNameDescription

2021-07-14 23:53:23,353 INFO [APP] User: A.Kay || module: setNameDescription

2021-07-14 23:53:23,353 INFO [APP] User: b_Kay || module: setNameDescription

 

any idea?

Thanks,

0 Karma

efika
Communicator

Not a problem. use:

 

rex "User\:(?<user>.+)\s\|\|\s(module\:(?<module>.+)|method\:(?<method>.+))"

0 Karma

indeed_2000
Motivator

sorry for miss spelling it is module I modify last reply.

and try this but not work

rex "User\:(?<user>.+)\s\|\|\s(module\:(?<module>.+)"

 

Any idea?

Thanks

 
 
0 Karma

venkatasri
SplunkTrust
SplunkTrust

@indeed_2000 What you have originally provided having different log structure. User: || module: 

These new logs having User: || method hence rex provided only works for module. Which one are correct events?

 

0 Karma

venkatasri
SplunkTrust
SplunkTrust

@indeed_2000 This one works for method. 

<your_search>
| rex "User\:\s+(?<user>\S+)\s+\|\|\s+method:\s+(?<method>\S+)$" 
| table user method

--

An upvote would be appreciated and accept solution if this reply helps!

indeed_2000
Motivator

it worked! thank you! 🙂

replace it with module

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...