Splunk Search

How to extract fields without regex?

ahooper239
New Member

I'm trying to extract fields from a message containing the following string..

'database'=running 'management'=running 'runtime'=running 'adclient'=running 'ntpd'=running 'logforward'=running,

I'm trying to create fields such as database, management, etc. that will store a value of running, down, etc. I tried using regex from the interactive field extractor but once I try to extract 'runtime' or anything past that, no regex can be extracted. Are there any simple ways of doing what I need to do?

Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Splunk can parse events of the form field=value, but I think the quotes in your example will be problematic.

A rex query is simple enough, assuming your fields are always in the same order.

<search> | rex "'database'=(?<database>\w+)\s'management'=(?<management>\w+)\s'runtime'=(?<runtime>\w+)\s ..." | ...

This works in RegExr, but I haven't verified the quotes won't confuse Splunk.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

 Ready to master Kubernetes and cloud monitoring like the pros? Join Splunk’s Growth Engineering team for an ...

Update Your SOAR Apps for Python 3.13: What Community Developers Need to Know

To Community SOAR App Developers - we're reaching out with an important update regarding Python 3.9's ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...