<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to achieve field with a value containing commas? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631062#M219196</link>
    <description>&lt;P&gt;Unfortunately I have no control over the log data formatting...&lt;/P&gt;
&lt;P&gt;it is in format:&amp;nbsp; Field1=Value1|Field2=Value2| ... |Criteria=one,two,three,99.0|...&lt;/P&gt;
&lt;P&gt;I have one field, Criteria, that has many values with embedded commas.&lt;/P&gt;
&lt;P&gt;Splunk search only give me the first value... I want all values treated as one in a stats count by&lt;/P&gt;
&lt;P&gt;I tried below to rewrite them, and do see the changes, but stats still getting only first value.&lt;/P&gt;
&lt;P&gt;index=myidx&amp;nbsp; Msg=mymsg&amp;nbsp; |&amp;nbsp; rex mode=sed field=_raw "s/,/-/g"&lt;BR /&gt;| bucket span=1d _time as ts&lt;BR /&gt;| eval ts=strftime(ts,"%Y-%m-%d")&lt;BR /&gt;| stats count by ts Criteria&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Feb 2023 20:54:10 GMT</pubDate>
    <dc:creator>Yossarian622</dc:creator>
    <dc:date>2023-02-15T20:54:10Z</dc:date>
    <item>
      <title>How to achieve field with a value containing commas?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631062#M219196</link>
      <description>&lt;P&gt;Unfortunately I have no control over the log data formatting...&lt;/P&gt;
&lt;P&gt;it is in format:&amp;nbsp; Field1=Value1|Field2=Value2| ... |Criteria=one,two,three,99.0|...&lt;/P&gt;
&lt;P&gt;I have one field, Criteria, that has many values with embedded commas.&lt;/P&gt;
&lt;P&gt;Splunk search only give me the first value... I want all values treated as one in a stats count by&lt;/P&gt;
&lt;P&gt;I tried below to rewrite them, and do see the changes, but stats still getting only first value.&lt;/P&gt;
&lt;P&gt;index=myidx&amp;nbsp; Msg=mymsg&amp;nbsp; |&amp;nbsp; rex mode=sed field=_raw "s/,/-/g"&lt;BR /&gt;| bucket span=1d _time as ts&lt;BR /&gt;| eval ts=strftime(ts,"%Y-%m-%d")&lt;BR /&gt;| stats count by ts Criteria&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 20:54:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631062#M219196</guid>
      <dc:creator>Yossarian622</dc:creator>
      <dc:date>2023-02-15T20:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to achieve field with a value containing commas?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631069#M219200</link>
      <description>&lt;P&gt;It is unfortunate that the log isn't quoted as we would have liked. &amp;nbsp;Fortunately, it is formatted well enough for kv aka &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Extract" target="_blank" rel="noopener"&gt;extract&lt;/A&gt;&amp;nbsp;command.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| kv pairdelim="|" ``` kvdelim defaults to "=" so it can be omitted ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 21:15:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631069#M219200</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-02-15T21:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to achieve field with a value containing commas?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631079#M219207</link>
      <description>&lt;P&gt;I added:&amp;nbsp;&amp;nbsp;| kv pairdelim="|"&lt;/P&gt;&lt;P&gt;but stats is still only showing me the first value before the comma&lt;/P&gt;&lt;P&gt;or - if i keep the&amp;nbsp;rex mode=sed field=_raw "s/,/-/g"&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 21:51:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631079#M219207</guid>
      <dc:creator>Yossarian622</dc:creator>
      <dc:date>2023-02-15T21:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to achieve field with a value containing commas?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631080#M219208</link>
      <description>&lt;P&gt;Sorry for misleading you about kvdelim. &amp;nbsp;You still need it when the string is not quoted.&lt;/P&gt;&lt;PRE&gt;| makeresults
| fields - _time
| eval _raw = "Field1=Value1|Field2=Value2| ... |Criteria=one,two,three,99.0|..."
| kv pairdelim="|" kvdelim="="&lt;/PRE&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Criteria&lt;/TD&gt;&lt;TD&gt;Field1&lt;/TD&gt;&lt;TD&gt;Field2&lt;/TD&gt;&lt;TD&gt;_raw&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;one,two,three,99.0&lt;/TD&gt;&lt;TD&gt;Value1&lt;/TD&gt;&lt;TD&gt;Value2&lt;/TD&gt;&lt;TD&gt;Field1=Value1|Field2=Value2| ... |Criteria=one,two,three,99.0|...&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 21:54:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631080#M219208</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-02-15T21:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to achieve field with a value containing commas?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631218#M219244</link>
      <description>&lt;P&gt;sorry but I am still only getting the first value before the comma/hyphen.&lt;/P&gt;&lt;P&gt;do I need to re eval the whole line?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 16:40:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631218#M219244</guid>
      <dc:creator>Yossarian622</dc:creator>
      <dc:date>2023-02-16T16:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to achieve field with a value containing commas?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631224#M219248</link>
      <description>&lt;P&gt;sorry but I am still only getting the first value before the first comma&lt;/P&gt;&lt;P&gt;do I need to do a re eval&lt;/P&gt;&lt;P&gt;should I be using mvindex in some form?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 17:13:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631224#M219248</guid>
      <dc:creator>Yossarian622</dc:creator>
      <dc:date>2023-02-16T17:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to achieve field with a value containing commas?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631284#M219269</link>
      <description>&lt;P&gt;Let's go back to your data. &amp;nbsp;The illustrated format, is it raw event or is it from one field? &amp;nbsp;What is the command that you last tried?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 06:33:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-field-with-a-value-containing-commas/m-p/631284#M219269</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-02-17T06:33:44Z</dc:date>
    </item>
  </channel>
</rss>

