Splunk Search

Regex : how to combine lookahead for following purpose?

axl88
Communicator

I am trying to clean log files to categorize them in Splunk, so my question is:

(?i)^(?:[^ ]* ){8} ((?P.+) ((?=\d{8}\d{8}\d{10}.)|(?=\d{8}.?))

bold area needs to be combined like if/else,[it selects good before bold lines]

I want it to STOP just before just-8 digits and dot (dddddddd.) OR 8digit_8digit_10digits (8xd_8xd_10xd.)

my task is to get rid of all unique numbers on log file that i can categorize it better.

please help,

1 Solution

axl88
Communicator
(?=\d{8}(?:_\d{8}_\d{10})?\.?) 

this satisfies my conditions above. I just need little more to add this personally.

View solution in original post

theunf
Communicator

My client needs to index MQ messages that have a variable payload from 1000 to 450k characters 😉

Does the transforms´ lookahead supports an unlimited value, like 0 or -1 ?

axl88
Communicator
(?=\d{8}(?:_\d{8}_\d{10})?\.?) 

this satisfies my conditions above. I just need little more to add this personally.

axl88
Communicator

(?=\d{8}(?:\d{8}\d{10})?.) this satisfies my conditions above. I just need little more to add this personally.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Okay, something like this?

(?i)Message:\s*(?<message>.*?)\s*[0-9_.]{8,}
0 Karma

axl88
Communicator

numbers could be at any place. @martin

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Are you possibly looking for something like this?

(?i)Message:\s*(?<message>.*?)\s*[0-9_.]*$
0 Karma

axl88
Communicator

input of first two lines , would be those two line outputs. Like I said, I m trying to generalize log messages via Regex to have something to monitor overall at the end.

0 Karma

axl88
Communicator

Input:
Timestamp: 2/26/2014 4:00:42 PM SN #7 Message: ServerXYZ: AppXYZ failed to grab activity code for response 12345678. Timestamp: 2/26/2014 3:37:42 PM SN #31 Message: Error copying folders, the following exception was thrown IOException: The process cannot access the file 12345678_12345678_1234567890'
Output: should refer to
AppXYZ failed to grab activity code for response
Error copying folders, the following exception was thrown IOException: The process cannot access the file
I desire no unique number fields,I can do some stats like what type of error I have on my site.

0 Karma

lukejadamec
Super Champion

It is not clear what you're trying to do.

The fieldname will not be variable. You might be better off with sed.
Can you post some actual examples?

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...