<?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: advanced json handling in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435228#M75933</link>
    <description>&lt;P&gt;in the sample set above, splunk would have 3 events.  It recognizes 2 fields:  user &lt;EM&gt;AND&lt;/EM&gt; h.hist{}{}&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jun 2019 18:42:10 GMT</pubDate>
    <dc:creator>awmorris</dc:creator>
    <dc:date>2019-06-19T18:42:10Z</dc:date>
    <item>
      <title>advanced json handling</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435225#M75930</link>
      <description>&lt;P&gt;i have a simplified data set that shows users and the number of times they have been seen using a given computer.  I want to use this to GUESS their primary computer.  Simple, right?  I think i'm missing something then...  Here's my data set&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
    "user" : "user1",
    "h" : {
        "hist" : [
            [
                "computer1",
                76
            ]
        ]
    }
}
{
    "user" : "user2",
    "h" : {
        "hist" : [
            [
                "computer2",
                4
            ],
            [
                "computer3",
                80
            ]
        ]
    }
}
{
    "user" : "user3",
    "h" : {
        "hist" : [
            [
                "computer4",
                213
            ],
            [
                "computer5",
                83
            ]
        ]
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results should be like:&lt;BR /&gt;
&lt;STRONG&gt;user1 : computer1&lt;BR /&gt;
user2 : computer3&lt;BR /&gt;
user3 : computer4&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 18:23:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435225#M75930</guid>
      <dc:creator>awmorris</dc:creator>
      <dc:date>2019-06-19T18:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: advanced json handling</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435226#M75931</link>
      <description>&lt;P&gt;It is worth noting that the history is variable.  Some users have a single machine, some have 2 machines, others have 15....  &lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 18:32:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435226#M75931</guid>
      <dc:creator>awmorris</dc:creator>
      <dc:date>2019-06-19T18:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: advanced json handling</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435227#M75932</link>
      <description>&lt;P&gt;What does this data look like in Splunk, have you (or has splunk automatically) done any field extractions yet, or do you need help completely from scratch?&lt;BR /&gt;
Are the separate users in separate events? Or is this all 1 big event?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 18:36:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435227#M75932</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-06-19T18:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: advanced json handling</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435228#M75933</link>
      <description>&lt;P&gt;in the sample set above, splunk would have 3 events.  It recognizes 2 fields:  user &lt;EM&gt;AND&lt;/EM&gt; h.hist{}{}&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 18:42:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435228#M75933</guid>
      <dc:creator>awmorris</dc:creator>
      <dc:date>2019-06-19T18:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: advanced json handling</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435229#M75934</link>
      <description>&lt;P&gt;And &lt;CODE&gt;h.hist{}{}&lt;/CODE&gt; is a multivalued field? What do the values in there look like?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 18:50:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435229#M75934</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-06-19T18:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: advanced json handling</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435230#M75935</link>
      <description>&lt;P&gt;You might consider the &lt;CODE&gt;seckit&lt;/CODE&gt; utilities on Splunkbase.  These do this and much more.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 21:58:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435230#M75935</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-19T21:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: advanced json handling</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435231#M75936</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults
|eval raw="{\"user\":\"user1\",\"h\":{\"hist\":[[\"computer1\",76]]}} {\"user\":\"user2\",\"h\":{\"hist\":[[\"computer2\",4],[\"computer3\",80]]}} {\"user\":\"user3\",\"h\":{\"hist\":[[\"computer4\",213],[\"computer5\",83]]}}"
| makemv raw
| mvexpand raw
| rename raw AS _raw
| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"
| rex mode=sed "s/\",(\d+)/\"=\1/g s/\":\"/\"=\"/ s/\"//g"
| kv
| fields - _*
| untable user computer logins
| stats sum(logins) AS logins BY computer user
| sort 0 - logins
| stats list(*) AS * BY user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You probably should change that last line to &lt;CODE&gt;| stats list(*) As * BY computer&lt;/CODE&gt; but that is more boring for the dataset that you provided.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 22:42:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435231#M75936</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-19T22:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: advanced json handling</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435232#M75937</link>
      <description>&lt;P&gt;This also assumes that your events are true JSON (no whitespace) like my events are.  If you really have all of that formatting whitespace, then have whomoever is sending it into Splunk trim out that fat and save you BIG BUCK$.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 22:44:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/advanced-json-handling/m-p/435232#M75937</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-19T22:44:01Z</dc:date>
    </item>
  </channel>
</rss>

