<?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 Convert stats to JSON in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Convert-stats-to-JSON/m-p/639074#M221435</link>
    <description>&lt;P&gt;I have a user who wants to send a table resulting from | stats values() to a summary index via the collect command, but all of the logs in this summary index need to be in json format. By default, collect just separates the field-value pairs by commas. How would we format these in json before or after the collect command sends them to the summary index?&lt;/P&gt;</description>
    <pubDate>Thu, 06 Apr 2023 19:27:23 GMT</pubDate>
    <dc:creator>wpb162</dc:creator>
    <dc:date>2023-04-06T19:27:23Z</dc:date>
    <item>
      <title>Convert stats to JSON</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-stats-to-JSON/m-p/639074#M221435</link>
      <description>&lt;P&gt;I have a user who wants to send a table resulting from | stats values() to a summary index via the collect command, but all of the logs in this summary index need to be in json format. By default, collect just separates the field-value pairs by commas. How would we format these in json before or after the collect command sends them to the summary index?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 19:27:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-stats-to-JSON/m-p/639074#M221435</guid>
      <dc:creator>wpb162</dc:creator>
      <dc:date>2023-04-06T19:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Convert stats to JSON</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-stats-to-JSON/m-p/639092#M221437</link>
      <description>&lt;P&gt;Like this:&lt;BR /&gt;&lt;BR /&gt;index=_*&lt;BR /&gt;| stats count values(sourcetype) AS sourcetype BY index&lt;BR /&gt;| tojson&lt;BR /&gt;| eval _time = now()&lt;BR /&gt;| table _raw&lt;BR /&gt;| collect index=main source="test" addtime=true testmode=true&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 20:36:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-stats-to-JSON/m-p/639092#M221437</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2023-04-06T20:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Convert stats to JSON</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-stats-to-JSON/m-p/639098#M221439</link>
      <description>&lt;P&gt;I appreciate your answer, and I hope to be able to use it very soon. However, we currently are running Splunk version 8.0.10, so I don't believe the tojson command is available to us.&amp;nbsp; If there is another (probably more complicated) way to do that with our current version, that would be fantastic. Otherwise, I expect we will have to wait until we upgrade.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 20:49:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-stats-to-JSON/m-p/639098#M221439</guid>
      <dc:creator>wpb162</dc:creator>
      <dc:date>2023-04-06T20:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: Convert stats to JSON</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-stats-to-JSON/m-p/639102#M221440</link>
      <description>&lt;P&gt;8.0 line has been unsupported for 1.5 years already...&lt;/P&gt;&lt;P&gt;Anyway, you can try to eval a json structure using json functions &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.10/SearchReference/JSONFunctions" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.10/SearchReference/JSONFunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 21:39:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-stats-to-JSON/m-p/639102#M221440</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-04-06T21:39:35Z</dc:date>
    </item>
  </channel>
</rss>

