<?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: EVAL JSON Consistency in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108835#M28377</link>
    <description>&lt;P&gt;"jaw drop" It does!  Thank you cphair, this is perfect.&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jul 2013 19:19:20 GMT</pubDate>
    <dc:creator>andywins</dc:creator>
    <dc:date>2013-07-30T19:19:20Z</dc:date>
    <item>
      <title>EVAL JSON Consistency</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108833#M28375</link>
      <description>&lt;P&gt;With JSON formatted events, I can do fun things like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="microBreadcrumb" | stats sum(message.totalIdle) as sumTotalIdle | table sumTotalIdle
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see, there is no problem accessing and using the second level within the JSON tree (message.totalIdle).  Why does this change when doing a simple eval like this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="microBreadcrumb" | eval test=message.totalIdle | table test
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;No results show up.  My guess is the period character "." is normally utilized for string appends within an EVAL expression.  Now, I can still accomplish the goal with spath:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="microBreadcrumb" | eval test=spath(_raw,"message.totalIdle") | table test
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;JSON field referencing seems inconsistent between various pipe expressions.  I would rather not clutter up the search with the spath function.  Don't get me wrong, the spath function is cleaner than the spath pipe expression (ie. &lt;CODE&gt;spath output=message_totalIdle path=message.totalIdle&lt;/CODE&gt;) but feel this is messy compared to basic k/v pair field references.  Also, EVALs still allow field references at the root level but nothing deeper.  Considering KV_MODE = json, I would enjoy referencing fields by the indexed "interesting fields" names on the left hand side panel.&lt;/P&gt;

&lt;P&gt;Am I missing something simple here?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2013 20:05:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108833#M28375</guid>
      <dc:creator>andywins</dc:creator>
      <dc:date>2013-07-29T20:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL JSON Consistency</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108834#M28376</link>
      <description>&lt;P&gt;I've never used JSON-formatted data in Splunk, but does it work if you enclose the name in single quotes?  E.g. eval test='message.totalIdle'&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2013 19:16:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108834#M28376</guid>
      <dc:creator>cphair</dc:creator>
      <dc:date>2013-07-30T19:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL JSON Consistency</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108835#M28377</link>
      <description>&lt;P&gt;"jaw drop" It does!  Thank you cphair, this is perfect.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2013 19:19:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108835#M28377</guid>
      <dc:creator>andywins</dc:creator>
      <dc:date>2013-07-30T19:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL JSON Consistency</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108836#M28378</link>
      <description>&lt;P&gt;Good to hear.  I'm not sure exactly how the search parser thinks, but I think the distinction between the cases is that for sum(message.totalIdle), the only way it makes sense is to treat the whole string as a single field name, whereas in the eval test=message.totalIdle it's ambiguous what the dot is supposed to do, so you need to use the single quotes to explicitly say "this is a field name; take its value."&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2013 19:26:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108836#M28378</guid>
      <dc:creator>cphair</dc:creator>
      <dc:date>2013-07-30T19:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL JSON Consistency</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108837#M28379</link>
      <description>&lt;P&gt;That makes sense to me.  I probably tried every bracket character besides single quotes.  It's critical details like these you skim over in the documentation.  Thanks again&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2013 19:30:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108837#M28379</guid>
      <dc:creator>andywins</dc:creator>
      <dc:date>2013-07-30T19:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL JSON Consistency</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108838#M28380</link>
      <description>&lt;P&gt;Single quotes actually work. Great job!&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2014 20:43:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108838#M28380</guid>
      <dc:creator>fleXible</dc:creator>
      <dc:date>2014-01-24T20:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL JSON Consistency</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108839#M28381</link>
      <description>&lt;P&gt;Tks.. its help me to&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2016 21:21:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EVAL-JSON-Consistency/m-p/108839#M28381</guid>
      <dc:creator>patrick_muller</dc:creator>
      <dc:date>2016-04-11T21:21:12Z</dc:date>
    </item>
  </channel>
</rss>

