Splunk Enterprise

How to extract the required keywords using REGEX

phanichintha
Path Finder

Hello!

Log:

transactionId: NA, businesskey: GRNJob, environment: prod, flowName: app-report-grn-scheduler-flow, message: Computed Range for Aribus GRN Query - {"viewTemplateName":"mcdonalds_Receipt_updatedRange",
"filters": {

Based on the above log, I need to search in any logs for the message: "anything". Please help the regex to find out.

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

I assume you are just looking for events with a match for "message:" followed by anything, not that you are trying to extract the "anything" into a field

| regex "message:\s[\w\s]+"
0 Karma

phanichintha
Path Finder

@ITWhisperer as per our yesterday's discussion i got the exact results. So same like this in some of the events am not able to get like this the Message field is not taking up to extract while combining in Example 2.

Example 1: Perfect output

host="mules1" OR host="mules2"
Message="message: Start of Flow CreateUser flow" OR
Message="message: All system calls for CREATE user is completed" | stats count by Message
| transpose 0 header_field=Message
| eval Failures='message: Start of Flow CreateUser flow'-'message: All system calls for CREATE user is completed'
| transpose 0 column_name=message header_field=column

phanichintha_0-1624946046644.png

Example 2: getting issue

phanichintha_1-1624946188391.png

but Individually showing events,

phanichintha_2-1624946248469.pngphanichintha_3-1624946288169.png

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What events and what fields ar already extracted when you do this search?

host="mules1" OR host="mules2" "nextFromDate for Ariba query set in s3 fromDateTimeUTC"
0 Karma

phanichintha
Path Finder

@ITWhisperer the events are related to "nextFromDate for Ariba query set in s3 fromDateTimeUTC" and the fields are below listed, in the files "Message" is extracted by me, based on that also some are not extracting under "Message" field.

phanichintha_0-1624948220578.png

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Isn't that the issue - that that Message field extraction is not working for all your events?

Do you need to extract it in the search? Can you share your current extract configuration?

0 Karma

priyanka_231019
Explorer

Try replacing rex statement with

 

rex field=_raw "message:(?<message>[\w\s]+)" 
0 Karma

phanichintha
Path Finder

@priyanka_231019 no use showing nothing,

phanichintha_0-1624944375345.pngphanichintha_1-1624944421818.png

 

0 Karma

venkatasri
SplunkTrust
SplunkTrust

Hi @phanichintha 

Based on your sample can you try following it extracts message: <value>, value to a field called message, which you can further use to filter events.

Note: Regex only works for combination of numbers, Alphabets, space and _ 

From above sample value would be extracted as, message =  Computed Range for Aribus GRN Query 

 

index=<your_index> sourcetype=<your_sourcetype>
| rex "message:(?<message>[\w\s]+)" 
| search message="<replace_it_with_string_you_want_to_search>"

 

---

An upvote would be appreciated and Accept Solution if it helps!

 

Tags (1)
0 Karma

phanichintha
Path Finder

@venkatasri its not showing any results based on your query

I tried: No output

phanichintha_0-1624940450781.png

The output will be like this:
Search:
host="mules1" OR host="mules2" "nextFromDate for Ariba query set in s3 fromDateTimeUTC"
Output:

phanichintha_1-1624940739913.png

 

 

Tags (1)
0 Karma

venkatasri
SplunkTrust
SplunkTrust

@phanichintha Originally there was no space in sample can you try this ,

Try | search =*nextFromDate for Ariba* something like this with wildcard there could be extra spaces being extracted.

index=<your_index> sourcetype=<your_sourcetype>
| rex "message:\s+(?<message>[\w\s]+)" 
| search message="<replace_it_with_string_you_want_to_search>"

 

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

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 ...