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!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...