<?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 Re: JSON format - EVAL-_raw =  gives duplicate content in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480550#M82392</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{\"log\":\"[2020/02/28 18:38:00] [error] [out_fw] no upstream connections available\",\"stream\":\"stderr\",\"docker\":{\"container_id\":\"736f7b10a0bda6b97267d8f51e9a8c1fbf8f8f41edea0f3d79b174b7dc5f48cb\"},\"kubernetes\":{\"container_name\":\"billing\",\"namespace_name\":\"pks-system\",\"pod_name\":\"telemetry-agent-77f797c749-qj9rv\",\"container_image\":\"pkstelemetrybot/telemetry-agent:latest\",\"container_image_id\":\"docker://sha256:c9dbff3df8b19ee2b91df08982cbdb0047bd8e0d830acba73e03959db80c6928\",\"pod_id\":\"dbbeee1f-63a4-4b03-a74b-0a53b5db44e8\",\"labels\":{\"app\":\"telemetry-agent\",\"pod-template-hash\":\"77f797c749\"},\"host\":\"77141ae5-920f-4f65-bd0a-ba78a85c157d\",\"master_url\":\"https://10.111.192.1:443/api\",\"namespace_id\":\"6e78cc1d-b345-44c3-b8e3-5c1af076afc5\"},\"K8Cluster\":\"k8s-cluster-test-kr-01\"}" 
| rex mode=sed "s/\{(\"log\"\:\".+?),.*/\1/"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;JSON has many &lt;CODE&gt;""&lt;/CODE&gt;. press ⌘(OR Ctrl)+F *2 and convert &lt;CODE&gt;"&lt;/CODE&gt;  to  &lt;CODE&gt;\"&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Feb 2020 22:59:25 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-02-28T22:59:25Z</dc:date>
    <item>
      <title>JSON format - EVAL-_raw =  gives duplicate content</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480545#M82387</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am trying to display at search time only the content of the "log" field - where the application data is.&lt;/P&gt;

&lt;P&gt;I am using the stanza below on the SH&lt;/P&gt;

&lt;P&gt;cheers,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source::http:k8s_test]
KV_MODE = json
EVAL-_raw = log
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;_raw event&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; { [-]
   K8Cluster: k8s-cluster-aa-bb-01
   docker: { [-]
     container_id: 919d689b4ee5aa0ac2ad7ac3333557b4bb7471da313ac9c7e6cbfc9c9e925e8a
   }
   kubernetes: { [+]
   }
   log: [2020/02/28 16:40:41] [error] [out_fw] no upstream connections available
   stream: stderr
} 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;output&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[2020/02/28 16:30:18] [error] [out_fw] no upstream connections available 
[2020/02/28 16:30:18] [error] [out_fw] no upstream connections available
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Feb 2020 16:46:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480545#M82387</guid>
      <dc:creator>petreb</dc:creator>
      <dc:date>2020-02-28T16:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: JSON format - EVAL-_raw =  gives duplicate content</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480546#M82388</link>
      <description>&lt;P&gt;Why not just do a &lt;CODE&gt;| table fields _time log&lt;/CODE&gt;?&lt;BR /&gt;
If you look at the raw events in search and expand a single event using the "&amp;gt;" under the "i" column (next to Time), do you see duplicate values for each of the fields? If so, that's a different problem, usually caused by both &lt;CODE&gt;INDEXED_FIELDS = json&lt;/CODE&gt; enabled on the HF/indexer as well as &lt;CODE&gt;KV_MODE = json&lt;/CODE&gt; being configured on the search head, which results in duplicate values in the JSON field extractions.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 18:24:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480546#M82388</guid>
      <dc:creator>masonmorales</dc:creator>
      <dc:date>2020-02-28T18:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: JSON format - EVAL-_raw =  gives duplicate content</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480547#M82389</link>
      <description>&lt;P&gt;I would like to do this transparently for the user, without piped commands&lt;/P&gt;

&lt;P&gt;the events come via HEC, and when I remove the EVAL-_raw = log line everything is displayed correctly in json format; I want to display only the content of the "log" field&lt;/P&gt;

&lt;P&gt;INDEXED_EXTRACTIONS is not set, and removing KV_MODE on the SH doesn't get rid of the additional line&lt;/P&gt;

&lt;P&gt;looks like EVAL doubles the values of all fields (excepting the default ones), not only log&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:22:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480547#M82389</guid>
      <dc:creator>petreb</dc:creator>
      <dc:date>2020-09-30T04:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: JSON format - EVAL-_raw =  gives duplicate content</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480548#M82390</link>
      <description>&lt;P&gt;&lt;CODE&gt;_raw&lt;/CODE&gt; is default indexed event field.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EVAL - _raw = log
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;does not replace indexed event. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{
    K8Cluster: k8s-cluster-aa-bb-01
    docker: { [-]
      container_id: 919d689b4ee5aa0ac2ad7ac3333557b4bb7471da313ac9c7e6cbfc9c9e925e8a
    }
    kubernetes: { [+]
    }
    log: [2020/02/28 16:40:41] [error] [out_fw] no upstream connections available
    stream: stderr
 } " 
| rex mode=sed "s/(?s).*(log\:.+?) stream.*/\1/"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As this result,&lt;BR /&gt;
&lt;EM&gt;props.conf&lt;/EM&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD - log = s/(?s).*(log\:.+?) stream.*/\1/
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but this depends on your LINE_BREAKER.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 19:09:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480548#M82390</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-28T19:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: JSON format - EVAL-_raw =  gives duplicate content</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480549#M82391</link>
      <description>&lt;P&gt;following your example I have tried with the format below, but somehow it interprets the string between square brackets as splunk command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
     | eval _raw="{"log":"[2020/02/28 18:38:00] [error] [out_fw] no upstream connections available","stream":"stderr","docker":{"container_id":"736f7b10a0bda6b97267d8f51e9a8c1fbf8f8f41edea0f3d79b174b7dc5f48cb"},"kubernetes":{"container_name":"billing","namespace_name":"pks-system","pod_name":"telemetry-agent-77f797c749-qj9rv","container_image":"pkstelemetrybot/telemetry-agent:latest","container_image_id":"docker://sha256:c9dbff3df8b19ee2b91df08982cbdb0047bd8e0d830acba73e03959db80c6928","pod_id":"dbbeee1f-63a4-4b03-a74b-0a53b5db44e8","labels":{"app":"telemetry-agent","pod-template-hash":"77f797c749"},"host":"77141ae5-920f-4f65-bd0a-ba78a85c157d","master_url":"https://10.111.192.1:443/api","namespace_id":"6e78cc1d-b345-44c3-b8e3-5c1af076afc5"},"K8Cluster":"k8s-cluster-test-kr-01"}"
     | rex mode=sed "s/\{("log"\:\".+?)\","stream.*/\1/"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Feb 2020 20:42:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480549#M82391</guid>
      <dc:creator>petreb</dc:creator>
      <dc:date>2020-02-28T20:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: JSON format - EVAL-_raw =  gives duplicate content</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480550#M82392</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{\"log\":\"[2020/02/28 18:38:00] [error] [out_fw] no upstream connections available\",\"stream\":\"stderr\",\"docker\":{\"container_id\":\"736f7b10a0bda6b97267d8f51e9a8c1fbf8f8f41edea0f3d79b174b7dc5f48cb\"},\"kubernetes\":{\"container_name\":\"billing\",\"namespace_name\":\"pks-system\",\"pod_name\":\"telemetry-agent-77f797c749-qj9rv\",\"container_image\":\"pkstelemetrybot/telemetry-agent:latest\",\"container_image_id\":\"docker://sha256:c9dbff3df8b19ee2b91df08982cbdb0047bd8e0d830acba73e03959db80c6928\",\"pod_id\":\"dbbeee1f-63a4-4b03-a74b-0a53b5db44e8\",\"labels\":{\"app\":\"telemetry-agent\",\"pod-template-hash\":\"77f797c749\"},\"host\":\"77141ae5-920f-4f65-bd0a-ba78a85c157d\",\"master_url\":\"https://10.111.192.1:443/api\",\"namespace_id\":\"6e78cc1d-b345-44c3-b8e3-5c1af076afc5\"},\"K8Cluster\":\"k8s-cluster-test-kr-01\"}" 
| rex mode=sed "s/\{(\"log\"\:\".+?),.*/\1/"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;JSON has many &lt;CODE&gt;""&lt;/CODE&gt;. press ⌘(OR Ctrl)+F *2 and convert &lt;CODE&gt;"&lt;/CODE&gt;  to  &lt;CODE&gt;\"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 22:59:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480550#M82392</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-28T22:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: JSON format - EVAL-_raw =  gives duplicate content</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480551#M82393</link>
      <description>&lt;P&gt;i did manage to fix it with&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EVAL-_raw = replace(_raw, "^\{\"log\"\:\"(.+?)\",\"stream.*", "\1")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf"&gt;looks like SEDCMD works only at index time&lt;/A&gt;, I was operating at search time level&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;SEDCMD- = &lt;BR /&gt;
* Only used at index time.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 09 Mar 2020 15:16:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-format-EVAL-raw-gives-duplicate-content/m-p/480551#M82393</guid>
      <dc:creator>petreb</dc:creator>
      <dc:date>2020-03-09T15:16:38Z</dc:date>
    </item>
  </channel>
</rss>

