<?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: Filtering 2 fields with multiple values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Filtering-2-fields-with-multiple-values/m-p/660497#M228024</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;I must filter which Host get which Risk (Hosts can have multiple Risk values) and what risk is falling away on which date and what risk is new&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;You need to first refine your requirement to a point you can mathematically, perhaps even visually represent the desired outcome. (This is really not about Splunk, but about data analytics.) &amp;nbsp;I cannot think of a single table to represent the above sentence. &amp;nbsp;Can you illustrate with a mock results table, and illustrate some mock data to derive that mock table? &amp;nbsp;Are you looking for multiple charts to represent each element in that sentence?&lt;/P&gt;</description>
    <pubDate>Thu, 12 Oct 2023 10:11:38 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2023-10-12T10:11:38Z</dc:date>
    <item>
      <title>Filtering 2 fields with multiple values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filtering-2-fields-with-multiple-values/m-p/660214#M227898</link>
      <description>&lt;P&gt;Hello ,&amp;nbsp;&lt;BR /&gt;i am new in Splunk and need help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;i get every week a vulnerability scan log with 2 main fields: "extracted_Host" and "Risk"&amp;nbsp;&lt;/P&gt;&lt;P&gt;Risk values are: Critical, High and Medium (in the log is often Medium so i must only search for Risk Medium and everything else is excluded)&lt;/P&gt;&lt;P&gt;Extracted_Host: i get many different Host IP&amp;nbsp;&lt;/P&gt;&lt;P&gt;I must filter which Host get which Risk (Hosts can have multiple Risk values) and what risk is falling away on which date and what risk is new&amp;nbsp;&lt;/P&gt;&lt;P&gt;right now i am here:&amp;nbsp;&lt;BR /&gt;Problem is i get only one host with all value fields and not how many Risk classification are really on this Host without any Time&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;index=nessus Risk IN (Critical,High,Medium)&lt;BR /&gt;| fields extracted_Host Risk&lt;BR /&gt;| eval Host=coalesce(extracted_Host,Risk,)&lt;BR /&gt;| stats values(*) as * by Host&lt;BR /&gt;&lt;BR /&gt;thanks for the help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 09:00:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filtering-2-fields-with-multiple-values/m-p/660214#M227898</guid>
      <dc:creator>LionSplunk</dc:creator>
      <dc:date>2023-10-10T09:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering 2 fields with multiple values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filtering-2-fields-with-multiple-values/m-p/660220#M227902</link>
      <description>&lt;P&gt;It is a little unclear how to help you as you haven't provided (anonymised) examples of the events you are dealing with. For example, do you get one event per host, with all their risks; one event per risk, with all the hosts; or, one event per host per risk, i.e. one host, one risk in each event.&lt;/P&gt;&lt;P&gt;Also, coalesce() does not function the way you seem to be using it - it doesn't concatenate the fields, it merely finds the first non-null field in the list.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 09:32:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filtering-2-fields-with-multiple-values/m-p/660220#M227902</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-10-10T09:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering 2 fields with multiple values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filtering-2-fields-with-multiple-values/m-p/660494#M228022</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;BR /&gt;sorry for the missing information. i am realy new to splunk and its complicated with all parameters.&lt;/P&gt;&lt;P&gt;I get one event per host per risk&amp;nbsp;&lt;/P&gt;&lt;P&gt;Means the host with the IP 10.10.10.10 get scanned with a vulnerability tool and after this i get a log with 20 different vulnerability events. Example maybe 2 with the risk classification Critical - 10 with the risk classification High and 8 with Medium. Every Risk is one event for this host means i get 20 different events on the same Host.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 09:31:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filtering-2-fields-with-multiple-values/m-p/660494#M228022</guid>
      <dc:creator>LionSplunk</dc:creator>
      <dc:date>2023-10-12T09:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering 2 fields with multiple values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filtering-2-fields-with-multiple-values/m-p/660497#M228024</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;I must filter which Host get which Risk (Hosts can have multiple Risk values) and what risk is falling away on which date and what risk is new&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;You need to first refine your requirement to a point you can mathematically, perhaps even visually represent the desired outcome. (This is really not about Splunk, but about data analytics.) &amp;nbsp;I cannot think of a single table to represent the above sentence. &amp;nbsp;Can you illustrate with a mock results table, and illustrate some mock data to derive that mock table? &amp;nbsp;Are you looking for multiple charts to represent each element in that sentence?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 10:11:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filtering-2-fields-with-multiple-values/m-p/660497#M228024</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-10-12T10:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering 2 fields with multiple values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filtering-2-fields-with-multiple-values/m-p/660857#M228158</link>
      <description>&lt;P&gt;&lt;SPAN&gt;With this filter i see all combined risk classification per host.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=test Risk IN (Critical,High,Medium)
| timechart span=30 count by extracted_Host &lt;/LI-CODE&gt;
&lt;P&gt;I'm now trying to filter and visualize so I can see how often the host has the rating Critical and how often high etc.&amp;nbsp; and&amp;nbsp; not like now that i see only the combined value of all risk classification&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=test
| stats count by extracted_Host, Risk
| stats values(Risk) as Risk by extracted_Host
| eval has_Critical=mvcount(split(Risk, ",")) &amp;gt; 0
| eval has_High=mvcount(split(Risk, ",")) &amp;gt; 0
| eval has_Medium=mvcount(split(Risk, ",")) &amp;gt; 0
| stats sum(has_Critical) as Critical_Count, sum(has_High) as High_Count, sum(has_Medium) as Medium_Count by extracted_Host&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;but i dont get an output&lt;/P&gt;
&lt;P&gt;Thanks for the help&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2023 14:03:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filtering-2-fields-with-multiple-values/m-p/660857#M228158</guid>
      <dc:creator>LionSplunk</dc:creator>
      <dc:date>2023-10-16T14:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering 2 fields with multiple values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filtering-2-fields-with-multiple-values/m-p/660947#M228190</link>
      <description>&lt;P&gt;First,&amp;nbsp;mvcount(split(Risk, ",")) will not give you any value if the host has more than one Risk because split function operates on string, not multivalue. &amp;nbsp;Second, I failed to see the logic to calculate has_Critical, has_High, and has_Mediium. &amp;nbsp;If the split works, wouldn't all three give the same value?&lt;/P&gt;&lt;P&gt;You still need to explain your actual use case in plain words AND illustrated mock outputs because the last stats&amp;nbsp;makes the end goal even less clear. &amp;nbsp;Suppose everything before that works, how can, say&amp;nbsp;&lt;U&gt;sum(has_Critical) as Critical_Count by extracted_Host&lt;/U&gt; give you anything &lt;EM&gt;EXCEPT&lt;/EM&gt; 1? &amp;nbsp;Do you want a count of number of host that has Critical risks? &amp;nbsp;In that case, you cannot have by extracted_Host. &amp;nbsp;Or do you mean you want a count of vulnerabilities on each extracted_Host that have risk rating of Critical? &amp;nbsp;In that case, your first stat, namely&amp;nbsp;&lt;U&gt;stats count by extracted_Host Risk&lt;/U&gt;&amp;nbsp;is all you need.&lt;/P&gt;&lt;P&gt;If you want the former, all that is needed is&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test Risk IN (Critical, High, Medium)
| stats dc(extracted_Host) as hostCount by Risk&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 00:10:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filtering-2-fields-with-multiple-values/m-p/660947#M228190</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-10-17T00:10:36Z</dc:date>
    </item>
  </channel>
</rss>

