<?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 search and report based on presence or lack of string? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-and-report-based-on-presence-or-lack-of-string/m-p/659410#M227677</link>
    <description>&lt;P&gt;Alternatively, use &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Fillnull" target="_blank" rel="noopener"&gt;fillnull&lt;/A&gt;.&lt;/P&gt;&lt;PRE&gt;&amp;lt;your_initial_search&amp;gt;&lt;BR /&gt;| fillnull account value="unverified"&lt;BR /&gt;| stats count by account&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Oct 2023 07:56:43 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2023-10-03T07:56:43Z</dc:date>
    <item>
      <title>How to search and report based on presence or lack of string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-and-report-based-on-presence-or-lack-of-string/m-p/659325#M227661</link>
      <description>&lt;P&gt;Have following data in the logfile&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{xxxx},{"GUID":"5561859B8D624FFC8FF0B87219060DC5"}
{xxxx},{"GUID":"5561859B8D624FFC8FF0B87219060DC6","account":"verified"}
{xxxx},{"GUID":"5561859B8D624FFC8FF0B87219060DC7","account":"unverified"}
{xxxx},{"GUID":"5561859B8D624FFC8FF0B87219060DC8","account":"verified"}
{xxxx},{"GUID":"5561859B8D624FFC8FF0B87219060DC9"}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Need Report like the following so that I should get the count of "verified" where it is explicitly mentioned otherwise it should show under "unverified" -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Type       Count
Verified     2
Unverified   3&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can we achieve this. Will appreciate your inputs!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 19:33:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-and-report-based-on-presence-or-lack-of-string/m-p/659325#M227661</guid>
      <dc:creator>runiyal</dc:creator>
      <dc:date>2023-10-02T19:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to search and report based on presence or lack of string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-and-report-based-on-presence-or-lack-of-string/m-p/659338#M227665</link>
      <description>&lt;P&gt;There is more than one way to do it but they all boil down to the same thing - categorize your data into two sets and then count them.&lt;/P&gt;&lt;PRE&gt;&amp;lt;your_initial_search&amp;gt;&lt;BR /&gt;| eval account=if(account=="verified","verified","unverified")&lt;BR /&gt;| stats count by account&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Oct 2023 20:58:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-and-report-based-on-presence-or-lack-of-string/m-p/659338#M227665</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-10-02T20:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to search and report based on presence or lack of string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-and-report-based-on-presence-or-lack-of-string/m-p/659410#M227677</link>
      <description>&lt;P&gt;Alternatively, use &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Fillnull" target="_blank" rel="noopener"&gt;fillnull&lt;/A&gt;.&lt;/P&gt;&lt;PRE&gt;&amp;lt;your_initial_search&amp;gt;&lt;BR /&gt;| fillnull account value="unverified"&lt;BR /&gt;| stats count by account&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 07:56:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-and-report-based-on-presence-or-lack-of-string/m-p/659410#M227677</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-10-03T07:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to search and report based on presence or lack of string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-and-report-based-on-presence-or-lack-of-string/m-p/659415#M227679</link>
      <description>&lt;P&gt;Yes, thought about fillnull myself. The difference is that fillnull only fills events where there is no value at all whereas the if-based eval can just sort the verified ones from all the rest (even if you have many other possible values like "unverified", "half-verified", "maybe verified but I really don't know" and so on ;-)). So depending on the use case either of the solutions can be appropriate.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 09:49:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-and-report-based-on-presence-or-lack-of-string/m-p/659415#M227679</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-10-03T09:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to search and report based on presence or lack of string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-and-report-based-on-presence-or-lack-of-string/m-p/659657#M227744</link>
      <description>&lt;P&gt;Thanks Rick.&lt;/P&gt;&lt;PRE&gt;| eval account=if(account=="verified","verified","unverified")&lt;BR /&gt;| stats count by account&lt;/PRE&gt;&lt;P&gt;Although data is there for both "verified" and "unverified" but I am getting result only for "unverified" (whatever is in the ELSE).&lt;/P&gt;&lt;P&gt;Any reason that you can think of this behavior?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 14:18:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-and-report-based-on-presence-or-lack-of-string/m-p/659657#M227744</guid>
      <dc:creator>runiyal</dc:creator>
      <dc:date>2023-10-04T14:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to search and report based on presence or lack of string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-and-report-based-on-presence-or-lack-of-string/m-p/659713#M227762</link>
      <description>&lt;P&gt;You need to accurately describe your raw data (anonymize as needed) and any relevant characteristics. (As a general rule, always describe data when asking data analytics questions.) &amp;nbsp;Which field name gives you "account"? &amp;nbsp;Based on your description, "account" is NOT the top level path in the JSON data; additionally, this path to "account" is inside an array according to your partial reveal. &amp;nbsp;Is it second level? &amp;nbsp;Third level?&lt;/P&gt;&lt;P&gt;Suppose your top level path is "events", i.e., raw data looks like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{"events" : [{xxxx},{"GUID":"5561859B8D624FFC8FF0B87219060DC5"}]}
{"events" : [{xxxx},{"GUID":"5561859B8D624FFC8FF0B87219060DC6","account":"verified"}]}
{"events" : [{xxxx},{"GUID":"5561859B8D624FFC8FF0B87219060DC7","account":"unverified"}]}
{"events" : [{xxxx},{"GUID":"5561859B8D624FFC8FF0B87219060DC8","account":"verified"}]}
{"events" : [{xxxx},{"GUID":"5561859B8D624FFC8FF0B87219060DC9"}]}&lt;/LI-CODE&gt;&lt;P&gt;Splunk would have given you flattened field names like events{}.GUID, events{}.account, etc. &amp;nbsp;If you know that every array events{} contains only a single event{}.account, you can just substitute "account" in solutions with event{}.account. &amp;nbsp;But as an array, events{}.account could be multivalued. &amp;nbsp;In that case, you need to make them single-valued first, i.e.,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath path=events{} ``` events{} should be the actual path of that array ```
| mvexpand events{}
| spath input=events{}
| eval account=if(account=="verified","verified","unverified")
| stats count by account&lt;/LI-CODE&gt;&lt;P&gt;Alternatively, use fillnull&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath path=events{} ``` events{} should be the actual path of that array ```
| mvexpand events{}
| spath input=events{}
| fillnull account value="unverified"
| stats count by account&lt;/LI-CODE&gt;&lt;P&gt;If "account" is not second level, or it is not really inside an array as your original description implied, you need to give accurate description of your data.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 19:46:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-and-report-based-on-presence-or-lack-of-string/m-p/659713#M227762</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-10-04T19:46:19Z</dc:date>
    </item>
  </channel>
</rss>

