How do I escape values in Splunk? -
splunk best practices use key/value pairs. says wrap values in quotes if contain spaces. so, let's have raw value of fred smith
:
my_key=name my_value="fred smith"
that's fine, i've added quotes. if have raw value of " fred smith"
(note quotes present , presence of space @ start) - yield:
my_key=name my_value="" fred smith""
this treated as:
my_key=name my_value="" my_key=fred my_value=smith""
what best practices escaping quotes in splunk values?
if control data format, appears do, options include:
- add single quotes around everything.
- use double-quotes, escape inner ones backslashes
- use json represent data instead of flat string of kv pairs. json syntax handles quoting case (without adding quote marks), plus can add nested structure if want.
you can control search-time field extraction behavior setting kv_mode
. may find auto_escaped
trick. see setting kv_mode search-time data in splunk knowledge manager manual.
Comments
Post a Comment