<?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: How to split columns based on timestamp and field value at the same time from JSON data? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-columns-based-on-timestamp-and-field-value-at-the/m-p/127652#M26237</link>
    <description>&lt;P&gt;Are the field extraction configured? Means are you getting following fields - block time    type1_metric1   type1_metric2   type2_metric1   type2_metric2&lt;/P&gt;

&lt;P&gt;If you are getting fields like that then try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search giving fields  block   time type1_metric1 type1_metric2 type2_metric1 type2_metric2 | eval column=time."-".block | fields - time block | untable column metrics value | chart sum(value) over metrics by column
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 28 Sep 2020 17:39:34 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2020-09-28T17:39:34Z</dc:date>
    <item>
      <title>How to split columns based on timestamp and field value at the same time from JSON data?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-columns-based-on-timestamp-and-field-value-at-the/m-p/127650#M26235</link>
      <description>&lt;P&gt;I have JSON data going into my Splunk index. Let's assume I am sending one JSON object array at a time through the REST API. The data looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[{'time':'timestamp1', 'block':'blockname1', type1_metric1:10, type1_metric2:20, type2_metric1:10, type2_metric2:20 },
{'time':'timestamp1', 'block':'blockname2', type1_metric1:15, type1_metric2:25, type2_metric1:15, type2_metric2:25 }]

[{'time':'timestamp2', 'block':'blockname1', type1_metric1:30, type1_metric2:40, type2_metric1:30, type2_metric2:40 },
{'time':'timestamp2', 'block':'blockname2', type1_metric1:35, type1_metric2:45, type2_metric1:35, type2_metric2:45 }]
...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For a given "metric type prefix" (like type1 or type2), I want to get a search result like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;                   blockname1                    blockname2
             timestamp1   timestamp2      timestamp1    timestamp2
type1_metric1   10      30                 15           35
type1_metric2   20      40                 25           45
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am fairly new to Splunk Query language and this looks like its going to be a fairly complex query and I am at loss where to even begin.&lt;/P&gt;

&lt;P&gt;Can someone help!? Cookies to anyone who can! (I will zip up my browser cookies and mail them to you, I swear!)&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2014 00:22:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-columns-based-on-timestamp-and-field-value-at-the/m-p/127650#M26235</guid>
      <dc:creator>shikhanshu</dc:creator>
      <dc:date>2014-09-17T00:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to split columns based on timestamp and field value at the same time from JSON data?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-columns-based-on-timestamp-and-field-value-at-the/m-p/127651#M26236</link>
      <description>&lt;P&gt;I have tried "transpose" and that gives the metrics as rows, but I am unable to split a "block" based on "time". Each event shows up as a separate column (which is expected I guess)&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2014 15:00:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-columns-based-on-timestamp-and-field-value-at-the/m-p/127651#M26236</guid>
      <dc:creator>shikhanshu</dc:creator>
      <dc:date>2014-09-17T15:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to split columns based on timestamp and field value at the same time from JSON data?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-columns-based-on-timestamp-and-field-value-at-the/m-p/127652#M26237</link>
      <description>&lt;P&gt;Are the field extraction configured? Means are you getting following fields - block time    type1_metric1   type1_metric2   type2_metric1   type2_metric2&lt;/P&gt;

&lt;P&gt;If you are getting fields like that then try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search giving fields  block   time type1_metric1 type1_metric2 type2_metric1 type2_metric2 | eval column=time."-".block | fields - time block | untable column metrics value | chart sum(value) over metrics by column
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:39:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-columns-based-on-timestamp-and-field-value-at-the/m-p/127652#M26237</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-28T17:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to split columns based on timestamp and field value at the same time from JSON data?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-columns-based-on-timestamp-and-field-value-at-the/m-p/127653#M26238</link>
      <description>&lt;P&gt;You are a genius! You gave me exactly what I needed. How can I make your comment as the "Answer"?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2014 23:10:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-columns-based-on-timestamp-and-field-value-at-the/m-p/127653#M26238</guid>
      <dc:creator>shikhanshu</dc:creator>
      <dc:date>2014-09-22T23:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to split columns based on timestamp and field value at the same time from JSON data?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-columns-based-on-timestamp-and-field-value-at-the/m-p/127654#M26239</link>
      <description>&lt;P&gt;Hi @shikhanshu&lt;/P&gt;

&lt;P&gt;I just converted @somesoni2's comment to an answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; be sure to accept the answer by clicking on the Accept button. You'll both receive karma points. Glad you got a solution!&lt;/P&gt;

&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2014 23:42:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-columns-based-on-timestamp-and-field-value-at-the/m-p/127654#M26239</guid>
      <dc:creator>ppablo</dc:creator>
      <dc:date>2014-09-22T23:42:23Z</dc:date>
    </item>
  </channel>
</rss>

