Splunk Search

How to extract one field from the data listed?

chrisschum
Path Finder

How would I go about performing a field extraction when the data is structured as follows:

->Message.[some random number]: "[The Subject Line of an Email]"

All of the message numbers would be different and all of the Subject Lines would be different but the structure shown above is always the same. I've tried using the Splunk Regular Expression tool but it doesn't seem to pickup this structure.

Thanks!

0 Karma
1 Solution

amiftah
Communicator

Try this: Message.\[(?<number>[^\[]+)]:\s*\"\[(?<subject>[^\[]+)]

View solution in original post

0 Karma

amiftah
Communicator

Try this: Message.\[(?<number>[^\[]+)]:\s*\"\[(?<subject>[^\[]+)]

0 Karma

chrisschum
Path Finder

Thanks for the quick response. I probably should have clarified that I just need one field extraction for all of the data listed. I also should have mentioned that the 'Subject Line' could be any alpha numeric characters separated by the quotes. Example; "Alert - Your Login Information"

Thanks!

0 Karma

chrisschum
Path Finder

I also may be putting in in the search incorrectly which may be why it isn't extracting with the search you provided. Thanks!

0 Karma

amiftah
Communicator

Actually my regex extracts 2 fields, number and subject, to execute it from the search bar type this index=yourIndex | rex field=_raw "Message.\[(?<number>[^\[]+)]:\s*\"\[(?<subject>[^\[]+)]" If you want to extract other values, can you provide more examples (like 3 events and highlight what you want to extract). Thanks

0 Karma

chrisschum
Path Finder

Okay, I think that got it. Thanks!

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!

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

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

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