<?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: Filter events by length of json field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Filter-events-by-length-of-json-field/m-p/552906#M156948</link>
    <description>&lt;P&gt;I thought this was the same as my struggle with dereferencing JSON paths but it is not. &amp;nbsp;This has to do with using len() in &lt;EM&gt;where&lt;/EM&gt; command with multivalue. &amp;nbsp;Here's a working filter:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|where isnotnull(len('x.y.z{}.field') &amp;gt; 20)
|stats count by x.y.z{}.field&lt;/LI-CODE&gt;&lt;P&gt;Note, however, that count by an array field is not going to work too well if all you care are the values in the array whose length is greater than 20. &amp;nbsp;In that case you'll have to apply the filter again after stats, like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|where isnotnull(len('x.y.z{}.field') &amp;gt; 20)
|stats count by x.y.z{}.field
|where isnotnull(len('x.y.z{}.field') &amp;gt; 20)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 May 2021 08:18:18 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2021-05-25T08:18:18Z</dc:date>
    <item>
      <title>Filter events by length of json field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-events-by-length-of-json-field/m-p/552813#M156918</link>
      <description>&lt;P&gt;I'm trying put together a query to find some outlier events with very long values within a complex structure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=myindex sourcetype=jsonfile
| where len('x.y.z{}.field') &amp;gt; 20
| stats count by x.y.z{}.field&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my first stab at how to do this, but it doesn't return any values, even though I know they are there.&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 17:09:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-events-by-length-of-json-field/m-p/552813#M156918</guid>
      <dc:creator>ShagVT</dc:creator>
      <dc:date>2021-05-24T17:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: Filter events by length of json field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-events-by-length-of-json-field/m-p/552906#M156948</link>
      <description>&lt;P&gt;I thought this was the same as my struggle with dereferencing JSON paths but it is not. &amp;nbsp;This has to do with using len() in &lt;EM&gt;where&lt;/EM&gt; command with multivalue. &amp;nbsp;Here's a working filter:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|where isnotnull(len('x.y.z{}.field') &amp;gt; 20)
|stats count by x.y.z{}.field&lt;/LI-CODE&gt;&lt;P&gt;Note, however, that count by an array field is not going to work too well if all you care are the values in the array whose length is greater than 20. &amp;nbsp;In that case you'll have to apply the filter again after stats, like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|where isnotnull(len('x.y.z{}.field') &amp;gt; 20)
|stats count by x.y.z{}.field
|where isnotnull(len('x.y.z{}.field') &amp;gt; 20)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 08:18:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-events-by-length-of-json-field/m-p/552906#M156948</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2021-05-25T08:18:18Z</dc:date>
    </item>
  </channel>
</rss>

