Splunk Search

How to split events in multiline raw data and extract fields?

vangal_sandeep
New Member

I have some data and  I am trying to  extract fields from multi line raw data.

 

TIMESTAMP=23-12-2021,Eligible_to_be_Purged=0,Total_Records_Inserted=79871,Row_Count=0,NUMORDERSPURGED=14267,INVOCATIONS=781016,AVERAGE=101.76,MAXIMUM=171465,NUMOFGETJOBSPROCESSED=163,GETJOBS_AVERAGE=17114.57 TIMESTAMP=24-12-2021,Eligible_to_be_Purged=0,Total_Records_Inserted=51367,Row_Count=0,NUMORDERSPURGED=206884,INVOCATIONS=471196,AVERAGE=981.21,MAXIMUM=237037,NUMOFGETJOBSPROCESSED=97,GETJOBS_AVERAGE=14298.03 TIMESTAMP=25-12-2021,Eligible_to_be_Purged=0,Total_Records_Inserted=57405,Row_Count=0,NUMORDERSPURGED=51558,INVOCATIONS=205747,AVERAGE=960.54,MAXIMUM=301445,NUMOFGETJOBSPROCESSED=45,GETJOBS_AVERAGE=36616.87

 

I wanted exact all fields from all 3 lines.

 

 

 

 

Labels (1)
Tags (2)
0 Karma

sperkins
Path Finder

You can use the field extractor to extract the fields based on the "," as the delimiter. 
Or | rex in the search bar.  Using the K=V pair extraction. (?<_KEY_1>[^=]+)=(?<_VAL_1>[^,]+),?
https://regex101.com/


Then use |eval <field> = mvindex(<ref_field>, #) To reference each value in a search, or you can use the | eval mvexpand()  function to split them into multiple events based on the field specified. 

https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/mvexpand

 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Don't do that. Split the event into separate events and then parse it. If you'll try to parse values from the event as such you're running into possibility of having "squished" multiple values. And the multivalued fields that you'd get as a result of parsing would be in no formal relation to one another.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

A Four-Part Event Series: Full Stack Observability For the AI Era

As AI reshapes applications, infrastructure, and the way teams operate, the traditional boundaries of ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...