Splunk Search

Getting information adjacent to a match.

jsven7
Communicator

Hello

Data example:

Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; MDDRJS)

I have to interpret the above MSIE 9.0 as IE 9. So far I've been able to find "MSIE" with this search:

| eval Browser=if(match(User_Agent,"(?i)MSIE"),"IE",User_Agent)

How do I extract only the "9.0" next to MSIE?

0 Karma
1 Solution

woodcock
Esteemed Legend

Assuming that you have another field which contains the information, such as UA_Versoin, like this:

| eval Browser=if(match(User_Agent,"(?i)MSIE"),"IE",User_Agent . " " . UA_Version)

View solution in original post

woodcock
Esteemed Legend

Assuming that you have another field which contains the information, such as UA_Versoin, like this:

| eval Browser=if(match(User_Agent,"(?i)MSIE"),"IE",User_Agent . " " . UA_Version)

jsven7
Communicator

Oh a concatenation that's great! Now in order to put the version into the field UA_Version, how do I perform more than one action within the if statement when it is true? That way I can split the UA_Version within the same if statement.

0 Karma

woodcock
Esteemed Legend

You can have multiple clauses like this;

if((((THIS) AND(THAT)) OR (SOMETHING)), "TrueText", "FalseText")
0 Karma

jsven7
Communicator

I love you. Thank you sir.

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...