Splunk Search

Grep a part of the multiline event.

sarvan7777
New Member

I want to strip few rows from my log file and create a report in Splunk. Here is a sample even.

blah blah blah
blah blah blah
COUNT TOPIC COMPONENT

======= =========== ==========
586 ABC DEF
231 MNO XYZ
blah blah blah
blah blah blah

All I need is the fields count, topic and component along with the values in my report. Any input is highly appreciated

Tags (1)
0 Karma
1 Solution

woodcock
Esteemed Legend

Like this:

Your Base Search Here
| rex "(?msi)^COUNT\s+TOPIC\s+COMPONENT[\r\n\s=]+(?<COUNT1>\S+)\s+(?<TOPIC1>\S+)\s+(?<COMPONENT1>\S+)[\r\n\s=]+(?<COUNT2>\S+)\s+(?<TOPIC2>\S+)\s+(?<COMPONENT2>\S+)"

You now have fields: COUNT1, TOPIC1, COMPONENT1, COUNT2, TOPIC2, and COMPONENT2.

View solution in original post

0 Karma

woodcock
Esteemed Legend

Like this:

Your Base Search Here
| rex "(?msi)^COUNT\s+TOPIC\s+COMPONENT[\r\n\s=]+(?<COUNT1>\S+)\s+(?<TOPIC1>\S+)\s+(?<COMPONENT1>\S+)[\r\n\s=]+(?<COUNT2>\S+)\s+(?<TOPIC2>\S+)\s+(?<COMPONENT2>\S+)"

You now have fields: COUNT1, TOPIC1, COMPONENT1, COUNT2, TOPIC2, and COMPONENT2.

0 Karma

sarvan7777
New Member

This is just what I want. Thanks for your response

0 Karma
Get Updates on the Splunk Community!

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...

Spotting Financial Fraud in the Haystack: A Guide to Behavioral Analytics with Splunk

In today's digital financial ecosystem, security teams face an unprecedented challenge. The sheer volume of ...

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability As businesses scale ...