Splunk Search

Quote escaping best practices

stevennoble
Explorer

I'm trying to figure out how I can format my logs such that splunk does not get confused by an escaped quote.
I'm currently doing something like

foo="a bunch of \"text\"" bar="a bunch \"more\" text"

And of course this quite confuses splunk. Assuming we don't want to switch to json how best to deal with quotes since backslash escaping doesn't seem to work.

Tags (2)
1 Solution

jtrucks
Splunk Employee
Splunk Employee

You will have to manually create field extractions to accommodate these logs. Once those are all configured and working, you shouldn't have to worry about auto-extracted fields with bad data. Check out KV_MODE in props.conf to disable auto-extracts for this source, too.

--
Jesse Trucks
Minister of Magic

View solution in original post

stevennoble
Explorer

Been playing with this. It appears KV_MODE = auto_escaped does everything I want

helge
Builder

This is the better answer

0 Karma

jtrucks
Splunk Employee
Splunk Employee

You will have to manually create field extractions to accommodate these logs. Once those are all configured and working, you shouldn't have to worry about auto-extracted fields with bad data. Check out KV_MODE in props.conf to disable auto-extracts for this source, too.

--
Jesse Trucks
Minister of Magic

stevennoble
Explorer

I don't mind escaping at search time. What I do mind is an extracted field of
foo: a bunch of

I can't change to single quotes because there are times where the single quote double quote distinction matters.

0 Karma

lukejadamec
Super Champion

If you use escape characters and quotes in your logs, then you will need to escape them both at search time.
If you don't wan't to escape quotes at search time, then use some a single quote in your logs.

Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...