<?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 count different fields from different hosts? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258293#M77389</link>
    <description>&lt;P&gt;Use the &lt;CODE&gt;coalesce&lt;/CODE&gt; command to combine the different fields into a new field.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(host="10.128.16.45" src=*) OR (host=”10.128.16.71” dst=*)| eval newField = coalesce(src, dst, svc) | stats count by newField |sort -count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 29 Jan 2016 17:54:49 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2016-01-29T17:54:49Z</dc:date>
    <item>
      <title>How to count different fields from different hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258292#M77388</link>
      <description>&lt;P&gt;Pardon if this is easy, I just finished going through the Searching and Reporting class and am attempting to utilize what I learned in practice. &lt;/P&gt;

&lt;P&gt;I'm attempting to correlate the number of malware events each endpoint on my network occurs over a given period. To do that, I need to count data from multiple hosts. The problem I'm running into, is the host identifies the endpoint in a different context in the log messages. In the logs, the victim endpoint might be identified as src=, dst= or dvc=. This is what I searched so far, but I don't know how to "count by" if the field is different. Thanks for any help. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(host="10.128.16.45" src=*) OR (host=”10.128.16.71” dst=*)|stats count by ??? |sort -count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Jan 2016 16:37:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258292#M77388</guid>
      <dc:creator>dwear</dc:creator>
      <dc:date>2016-01-29T16:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to count different fields from different hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258293#M77389</link>
      <description>&lt;P&gt;Use the &lt;CODE&gt;coalesce&lt;/CODE&gt; command to combine the different fields into a new field.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(host="10.128.16.45" src=*) OR (host=”10.128.16.71” dst=*)| eval newField = coalesce(src, dst, svc) | stats count by newField |sort -count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Jan 2016 17:54:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258293#M77389</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-01-29T17:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to count different fields from different hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258294#M77390</link>
      <description>&lt;P&gt;Could you post some sample data and perhaps a mock-up of what you want the results to look at?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2016 18:52:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258294#M77390</guid>
      <dc:creator>masonmorales</dc:creator>
      <dc:date>2016-01-29T18:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to count different fields from different hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258295#M77391</link>
      <description>&lt;P&gt;Since I'm still new, I can't post a image of my logs but here is the generalization. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Appliance A: Malware Alert src=10.128.36.100 dst=96.127.180.106

Appliance B: Malware Alert src=96.127.180.106 dst=10.128.36.100
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this example I only care about listing the internal IP's or anything with 10.128.36.* &lt;/P&gt;

&lt;P&gt;If I only use one appliance it works perfectly. I do host="Appliance A" src=* |stats count by src |sort -count&lt;/P&gt;

&lt;P&gt;The issue is since Appliance A and Appliance B have the 10.128.36 network in different fields, how to I count both those fields, without counting ALL src and ALL dst?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2016 19:05:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258295#M77391</guid>
      <dc:creator>dwear</dc:creator>
      <dc:date>2016-01-29T19:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to count different fields from different hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258296#M77392</link>
      <description>&lt;P&gt;Thanks! Since both src and dst are in almost all of my logs, wont coalesce collect ALL those values when I only really care about half of them? I only really care about whichever field contains the 10.128 network. &lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2016 19:11:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258296#M77392</guid>
      <dc:creator>dwear</dc:creator>
      <dc:date>2016-01-29T19:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to count different fields from different hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258297#M77393</link>
      <description>&lt;P&gt;Yes, you are correct.  That wasn't clear from your original posting.  Here's another approach.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=* | eval addr=case(cidrmatch("10.128.36/24",src),src,cidrmatch("10.128.36/24",dst),dst) | stats count by addr | sort - count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Jan 2016 19:28:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258297#M77393</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-01-29T19:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to count different fields from different hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258298#M77394</link>
      <description>&lt;P&gt;Awesome thanks Rich. Since I have numerous other, non relevant devices sending data to the same splunk instance, I had filtered it down some. It looks like its working correctly, can you just verify my syntax isn't over including or excluding anything?&lt;/P&gt;

&lt;P&gt;host=10.128.16.71 OR host=10.128.16.45 | eval addr=case(cidrmatch("10.128/16",src),src,cidrmatch("10.128./16",dst),dst) | stats count by addr | sort - count&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 19:55:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258298#M77394</guid>
      <dc:creator>dwear</dc:creator>
      <dc:date>2016-02-01T19:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to count different fields from different hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258299#M77395</link>
      <description>&lt;P&gt;There's an extra '.' in your second CIDR.  Otherwise, it looks fine.  Of course, I don't know your network configuration so I don't know if your CIDRs are correct.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 12:36:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-different-fields-from-different-hosts/m-p/258299#M77395</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-02-02T12:36:48Z</dc:date>
    </item>
  </channel>
</rss>

