<?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: Eventstructure &amp; &amp;quot;By&amp;quot; command / spath in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eventstructure-quot-By-quot-command-spath/m-p/111835#M29322</link>
    <description>&lt;P&gt;Hi MuS,&lt;/P&gt;

&lt;P&gt;haven't heard about that command before, but it looks usefull for my problem. Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jan 2014 13:46:37 GMT</pubDate>
    <dc:creator>HeinzWaescher</dc:creator>
    <dc:date>2014-01-14T13:46:37Z</dc:date>
    <item>
      <title>Eventstructure &amp; "By" command / spath</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eventstructure-quot-By-quot-command-spath/m-p/111833#M29320</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I've got an event that looks like this:&lt;/P&gt;

&lt;P&gt;rangeofproducts:{[-]&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;              products:[[-]
                {[-]
                  count:20
                  productID: A
                }
                {[-]
                  count:40
                  productID: B
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So the fieldnames are:&lt;BR /&gt;
rangeofproducts.products{}.count&lt;BR /&gt;
rangeofproducts.products{}.productID&lt;/P&gt;

&lt;P&gt;I would like to create a search thats results in the total count by productID for the event.&lt;BR /&gt;
At the moment I think it won't work, but I hope I'm wrong...&lt;/P&gt;

&lt;P&gt;| stats sum(rangeofproducts.products{}.count) by rangeofproducts.products{}.productID&lt;/P&gt;

&lt;P&gt;This results in a total count of 60 for every productID. But a split 20/40 would be correct.&lt;/P&gt;

&lt;P&gt;Best &lt;BR /&gt;
Heinz&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2014 08:32:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eventstructure-quot-By-quot-command-spath/m-p/111833#M29320</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2014-01-14T08:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Eventstructure &amp; "By" command / spath</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eventstructure-quot-By-quot-command-spath/m-p/111834#M29321</link>
      <description>&lt;P&gt;Hi HeinzWaescher,&lt;/P&gt;

&lt;P&gt;looks like JSON data, have you tried the &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.1/SearchReference/Spath"&gt;spath&lt;/A&gt; command on your event and do your stats after that?&lt;/P&gt;

&lt;P&gt;hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2014 08:37:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eventstructure-quot-By-quot-command-spath/m-p/111834#M29321</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-01-14T08:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Eventstructure &amp; "By" command / spath</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eventstructure-quot-By-quot-command-spath/m-p/111835#M29322</link>
      <description>&lt;P&gt;Hi MuS,&lt;/P&gt;

&lt;P&gt;haven't heard about that command before, but it looks usefull for my problem. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2014 13:46:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eventstructure-quot-By-quot-command-spath/m-p/111835#M29322</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2014-01-14T13:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Eventstructure &amp; "By" command / spath</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eventstructure-quot-By-quot-command-spath/m-p/111836#M29323</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Example 3 of the &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.1/SearchReference/Spath"&gt;spath&lt;/A&gt; documentation seems to be the apporach for my problem.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"widget": {
"text": {
    "data": "Click here",
    "size": 36,
    "data": "Learn more",
    "size": 37,
    "data": "Help",
    "size": 38,
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've tried it out and adjusted this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=json | spath | rename widget.text.size AS size, widget.text.data AS
data | eval x=mvzip(data,size)| mvexpand x | eval x = split(x,",") | eval
data=mvindex(x,0) | eval size=mvindex(x,1) | table _time,data, size
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the end the search created individual events, but there are always duplicates. When I use the same search without &lt;EM&gt;| spath |&lt;/EM&gt; it seems to be correct, but I've no idea why. &lt;BR /&gt;
Is there an important difference in the structure of my event? &lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;

&lt;P&gt;Heinz&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2014 11:39:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eventstructure-quot-By-quot-command-spath/m-p/111836#M29323</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2014-01-21T11:39:54Z</dc:date>
    </item>
  </channel>
</rss>

