<?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 Finding clientip where more than one of event X but none of event Y in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99608#M182710</link>
    <description>&lt;P&gt;I want to find clientip's (in apache access_combined logs) where more than one event occurred (e.g. status=200 file=&lt;EM&gt;FOO&lt;/EM&gt;) but the same client IP has no other sort of activity ... (e.g. clientip=OneofThoseIPs NOT(file=&lt;EM&gt;FOO&lt;/EM&gt;) | stats count by file | where count = 0)&lt;/P&gt;

&lt;P&gt;I can think of how to do it in a SQL WHERE ... AND clause/query, but am struggling in SPLUNK to accomplish it.&lt;/P&gt;

&lt;P&gt;Any help appreciated ... thanks&lt;/P&gt;</description>
    <pubDate>Thu, 22 Mar 2012 15:56:15 GMT</pubDate>
    <dc:creator>jewhite</dc:creator>
    <dc:date>2012-03-22T15:56:15Z</dc:date>
    <item>
      <title>Finding clientip where more than one of event X but none of event Y</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99608#M182710</link>
      <description>&lt;P&gt;I want to find clientip's (in apache access_combined logs) where more than one event occurred (e.g. status=200 file=&lt;EM&gt;FOO&lt;/EM&gt;) but the same client IP has no other sort of activity ... (e.g. clientip=OneofThoseIPs NOT(file=&lt;EM&gt;FOO&lt;/EM&gt;) | stats count by file | where count = 0)&lt;/P&gt;

&lt;P&gt;I can think of how to do it in a SQL WHERE ... AND clause/query, but am struggling in SPLUNK to accomplish it.&lt;/P&gt;

&lt;P&gt;Any help appreciated ... thanks&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2012 15:56:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99608#M182710</guid>
      <dc:creator>jewhite</dc:creator>
      <dc:date>2012-03-22T15:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Finding clientip where more than one of event X but none of event Y</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99609#M182711</link>
      <description>&lt;P&gt;You can use eval within stats to count the events that match a predicate. For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats count(eval(status=200 AND file="FOO")) as successful_foo_count count(eval(status=200 AND file!="FOO")) as other_access_count by clientip
| where successful_foo_count&amp;gt;0 AND other_access_count==0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Mar 2012 16:27:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99609#M182711</guid>
      <dc:creator>Stephen_Sorkin</dc:creator>
      <dc:date>2012-03-22T16:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Finding clientip where more than one of event X but none of event Y</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99610#M182712</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;

&lt;P&gt;The count(eval()) as fieldLabel is what I needed ... Doing either 'stats count ...' operation works by itself.  Testing it more though, the issue is that since one of the generated fields (the other_access_count) is 0 it appears it can't count the hits when they are together.  Will have to rethink it a little more.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:33:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99610#M182712</guid>
      <dc:creator>jewhite</dc:creator>
      <dc:date>2020-09-28T11:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Finding clientip where more than one of event X but none of event Y</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99611#M182713</link>
      <description>&lt;P&gt;I don't quite follow. This search should be able to count the number of occurrences of any set of types of events, globally, for each clientip.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2012 17:19:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99611#M182713</guid>
      <dc:creator>Stephen_Sorkin</dc:creator>
      <dc:date>2012-03-22T17:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Finding clientip where more than one of event X but none of event Y</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99612#M182714</link>
      <description>&lt;P&gt;Still playing with it ... but here's a basic question, I haven't found a clear answer to and testing seems to indicate a 'no' answer ...&lt;/P&gt;

&lt;P&gt;Can you wildcard in eval? [ e.g. eval(field="*foo") ]&lt;/P&gt;

&lt;P&gt;I'm playing with match options as well ... seems to work a little better, but still not quite there.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2012 13:27:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99612#M182714</guid>
      <dc:creator>jewhite</dc:creator>
      <dc:date>2012-03-26T13:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Finding clientip where more than one of event X but none of event Y</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99613#M182715</link>
      <description>&lt;P&gt;Yes. You the&lt;CODE&gt;like()&lt;/CODE&gt; function implements SQL's LIKE (where "%" is used as a wildcard, &lt;CODE&gt;match()&lt;/CODE&gt; implements regex matching functionality (where ".*" is a wildcard) and &lt;CODE&gt;searchmatch()&lt;/CODE&gt; takes a standard Splunk search expression (like &lt;CODE&gt;searchmatch("field=foo")&lt;/CODE&gt; or &lt;CODE&gt;searchmatch("field=\"foo bar\"")&lt;/CODE&gt;. You can read about these, and other, eval functions at &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/CommonEvalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/CommonEvalFunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2012 13:44:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99613#M182715</guid>
      <dc:creator>Stephen_Sorkin</dc:creator>
      <dc:date>2012-03-26T13:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: Finding clientip where more than one of event X but none of event Y</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99614#M182716</link>
      <description>&lt;P&gt;interesting ... because &lt;BR /&gt;
source="/var/log/*/*access_log" | stats count(eval(file="*foo" AND status=200)) as fooCount by clientip&lt;BR /&gt;
| where fooCount &amp;gt; 10 | sort by clientip&lt;/P&gt;

&lt;P&gt;returns 0 results, but &lt;/P&gt;

&lt;P&gt;source="/var/log/*/www*access_log" | stats count(eval(file="fullFileName.foo" AND status=200)) as fooCount by clientip&lt;BR /&gt;
| where fooCount &amp;gt; 10 | sort by clientip&lt;/P&gt;

&lt;P&gt;returns a list of results (both return lots of matching events)&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:34:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99614#M182716</guid>
      <dc:creator>jewhite</dc:creator>
      <dc:date>2020-09-28T11:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Finding clientip where more than one of event X but none of event Y</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99615#M182717</link>
      <description>&lt;P&gt;The first one will match the exact string "*foo" for file, which is not what you want.&lt;/P&gt;

&lt;P&gt;Instead, write &lt;CODE&gt;stats count(eval(match(file, ".*foo"))) as fooCount by clientip&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2012 16:25:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99615#M182717</guid>
      <dc:creator>Stephen_Sorkin</dc:creator>
      <dc:date>2012-03-26T16:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Finding clientip where more than one of event X but none of event Y</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99616#M182718</link>
      <description>&lt;P&gt;That's the path I was headed down ... see below for final solution (had to figure out how to get the negative match).&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2012 16:43:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99616#M182718</guid>
      <dc:creator>jewhite</dc:creator>
      <dc:date>2012-03-26T16:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Finding clientip where more than one of event X but none of event Y</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99617#M182719</link>
      <description>&lt;P&gt;Final solution ... Thanks for the help!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/var/log/*/*access_log" | stats count(eval(match(file,"foo") AND status=200)) as countFOO count(eval(match(file,"^foo"))) as countNonFOO by clientip
| where countFOO &amp;gt; 0 AND countNonFOO &amp;lt; 1 | sort by clientip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Mar 2012 16:45:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-clientip-where-more-than-one-of-event-X-but-none-of/m-p/99617#M182719</guid>
      <dc:creator>jewhite</dc:creator>
      <dc:date>2012-03-26T16:45:14Z</dc:date>
    </item>
  </channel>
</rss>

