<?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 use append to list out the values respective to the results we get? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-append-to-list-out-the-values-respective-to-the/m-p/373543#M109849</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main
| stats count AS Total, count(age) AS MATCHED BY Name location
| eval UNMATCHED = Total - MATCHED
| multireport

[ stats sum(*) AS * BY location
| eval PercentExists = round(100 * MATCHED / Total, 1) + "%"
| eval PercentDoesNotExist = round(100 * UNMATCHED / Total, 1) + "%" ]

[ eval PercentExists = round(100 * MATCHED / Total, 1)
| sort 0 - pctMatched
| dedup 5 location
| eval Top_5_Unmatched_Names = "Name=" . Name . ", Total=" . Total . ", PercentExists=" . PercentExists . "%"
| table Top_5_Unmatched_Names location ]

| stats list(*) AS * BY location
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 02 May 2018 15:00:12 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2018-05-02T15:00:12Z</dc:date>
    <item>
      <title>how to use append to list out the values respective to the results we get?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-append-to-list-out-the-values-respective-to-the/m-p/373542#M109848</link>
      <description>&lt;P&gt;I have got multiple events in a log file which contains few key-value pairs and i want to look at only the existence of three key-value pairs (name and location) in all the events.&lt;/P&gt;

&lt;P&gt;Name="xyz", age="aa" and location="zzz"&lt;/P&gt;

&lt;P&gt;I want to find the percentage of events where "age" does not exist by location and all the "Name" by location&lt;/P&gt;

&lt;P&gt;I have following query which gives me the result but not what im expecting.&lt;/P&gt;

&lt;P&gt;Key "Name" is being in under location where the event "age" does not exist. The column should be blank under location if "age" does not exist.&lt;/P&gt;

&lt;P&gt;Also I need recent five "Name" in which age does not exist.&lt;/P&gt;

&lt;P&gt;index=main&lt;BR /&gt;
| stats count as Total, count(eval(NOT isnull(age))) as MATCHED count(eval(isnull(age))) as UNMATCHED by location&lt;BR /&gt;
| eval pctMatched = round(MATCHED/Total*100, 1)&lt;BR /&gt;
| eval pctUnmatched = round(UNMATCHED/Total*100, 1)&lt;BR /&gt;
| eval PercentExists = pctMatched + "%"&lt;BR /&gt;
| eval PercentDoesNotExist = pctUnmatched + "%"&lt;BR /&gt;
| table cluster percentTagged percentUntagged&lt;BR /&gt;
| appendcols [ search index=main&lt;BR /&gt;
| stats count by location, Name&lt;BR /&gt;
| sort -count &lt;BR /&gt;
| streamstats count as rank by location | where rank &amp;lt;= 5&lt;BR /&gt;
| stats list(Name) as Name, list(count) as count by location&lt;BR /&gt;
| fields - location, count&lt;BR /&gt;
| table Name ]&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:20:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-append-to-list-out-the-values-respective-to-the/m-p/373542#M109848</guid>
      <dc:creator>bollam</dc:creator>
      <dc:date>2020-09-29T19:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to use append to list out the values respective to the results we get?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-append-to-list-out-the-values-respective-to-the/m-p/373543#M109849</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main
| stats count AS Total, count(age) AS MATCHED BY Name location
| eval UNMATCHED = Total - MATCHED
| multireport

[ stats sum(*) AS * BY location
| eval PercentExists = round(100 * MATCHED / Total, 1) + "%"
| eval PercentDoesNotExist = round(100 * UNMATCHED / Total, 1) + "%" ]

[ eval PercentExists = round(100 * MATCHED / Total, 1)
| sort 0 - pctMatched
| dedup 5 location
| eval Top_5_Unmatched_Names = "Name=" . Name . ", Total=" . Total . ", PercentExists=" . PercentExists . "%"
| table Top_5_Unmatched_Names location ]

| stats list(*) AS * BY location
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 May 2018 15:00:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-append-to-list-out-the-values-respective-to-the/m-p/373543#M109849</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-02T15:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to use append to list out the values respective to the results we get?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-append-to-list-out-the-values-respective-to-the/m-p/373544#M109850</link>
      <description>&lt;P&gt;I reedited/resubmitted this about 20 times so if it didn't work, make sure you refresh and try the updated answer.&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 15:11:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-append-to-list-out-the-values-respective-to-the/m-p/373544#M109850</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-02T15:11:05Z</dc:date>
    </item>
  </channel>
</rss>

