Splunk Search

How do you regex multiple keywords that are shown in a log?

limalbert
Path Finder

If I'm trying to regex InteractionID and msg below, how do I get the results for all InteractionID and msg within the same transactionID?

Log example:

transactionID=888999;InteractionID=123;msg=hello;...;InteractionID=456;msg=world;...
transactionID=000011;InteractionID=789;msg=foo;...;InteractionID=556;msg=test;...

... means texts

InteractionID field should contain 123, 456, 789, 556
msg field should contain hello, world, foo, test

0 Karma

woodcock
Esteemed Legend

Like this:

| makeresults 
| eval _raw="transactionID=888999;InteractionID=123;msg=hello;...;InteractionID=456;msg=world;..." 

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| rex max_match=0 "InteractionID=(?<InteractionID>\d+);msg=(?<msg>[^;]+)"

chrisyounger
SplunkTrust
SplunkTrust

Give this a try : | makemv tokenizer="msg=([^;]+);?" _raw

Here is the example i used to test it:

| makeresults
| eval _raw="transactionID=888999;InteractionID=123;msg=hello;...;InteractionID=456;msg=world;..."
| extract
| makemv tokenizer="msg=([^;]+);?" _raw

I hope this solves your problem

0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...