Splunk Search

Can you tell Auto KV to honor values within single quotes instead of double quotes?

Lowell
Super Champion

I feel like I should know the answer to this, but just in case I missed something....

Splunk automatically handles field extractions for events like this very well:

Thu Jan 14 10:46:02 EST 2016 myfakeservice[3]:  successful login.  user="joe" ip="10.0.0.99"

This works, but it results in all field values wrapped in literal single quotes:

Thu Jan 14 10:46:02 EST 2016 myfakeservice[3]:  successful login.  user='joe' ip='10.0.0.99'

So user is now 'joe' and ip is now '10.0.0.99' (Because the single quotes become part of the field's value.)

Is there a way to make this work more efficiently with Splunk's automatic KV mode ( KV_MODE=auto ) so that single quotes are treated as double quotes are traditionally handled?

I realize this can be done with a REGEX, but I was hoping for a better solution.

0 Karma

woodcock
Esteemed Legend

You can create your own KV_MODE extractions like this:

props.conf:

REPORT-kvmode = single_quote_kvps

transforms.conf:

[single_quote_kvps]
FORMAT = $1::$2
MV_ADD = 1
REGEX = ([^=\s]+)='([^']+)'
SOURCE_KEY = _raw
0 Karma

Lowell
Super Champion

I was hoping that Splunk would have added support for this without requiring a REGEX, but I'm doubtful any such solution exists. My understanding is that dynamic key regex have some negative performance implications. ( $1::$2 )

0 Karma

woodcock
Esteemed Legend

How do you think the built-in works? Productivity should usually trump performance, although the latter should never be ignored.

0 Karma
Get Updates on the Splunk Community!

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...

Stay Connected: Your Guide to October Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...