<?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: Help counting, the field, pageName, when I'm trying to count two or more specific values. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496403#M194655</link>
    <description>&lt;P&gt;I didn't try this format.  I'll give it a try this morning when I'm back in Splunk.  Thanks for the help!&lt;/P&gt;</description>
    <pubDate>Wed, 04 Dec 2019 14:17:18 GMT</pubDate>
    <dc:creator>rick4039</dc:creator>
    <dc:date>2019-12-04T14:17:18Z</dc:date>
    <item>
      <title>Help counting, the field, pageName, when I'm trying to count two or more specific values.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496397#M194649</link>
      <description>&lt;P&gt;Using Splunk Cloud - 7.0.11&lt;BR /&gt;
My goal is to create a search and generate a table that I can use with MLTK.  I'm searching for a relationship between a particular API, it's responseTime, two specific web pages and corresponding status codes.&lt;/P&gt;

&lt;P&gt;When the API, serviceName="/api/more/auth" appears, I want to capture the count for the field, pageName but only when its value is:  pageName="Error : API Failure" OR pageName="Device : Device Wall"&lt;BR /&gt;
Along with this, I'm after the count for a handful of status' (i.e. responseCode is 422, 500, 503 and 504 as well as the responseTime. &lt;BR /&gt;
&lt;STRONG&gt;Here is my sample search:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;sourcetype=json_auto_timestamp index="webprod"  serviceName="/api/more/auth" AND (responseCode=422 OR responseCode=500 OR responseCode=503 OR responseCode=504) AND responseTime="*" OR pageName="Error : API Failure" OR pageName="Device : Device Wall"&lt;BR /&gt;
    | bin _time span=5m&lt;BR /&gt;
    | stats&lt;BR /&gt;
         count(pageName="Error : API Failure") as PageUnav&lt;BR /&gt;
         count(pageName="Device : Device Wall") as DevWall&lt;BR /&gt;
         avg(responseTime) as RspTimeAvg&lt;BR /&gt;
         count(eval(responseCode==422)) as 422&lt;BR /&gt;
         count(eval(responseCode==500)) as 500&lt;BR /&gt;
         count(eval(responseCode==503)) as 503&lt;BR /&gt;
         count(eval(responseCode==504)) as 504&lt;BR /&gt;
         by _time&lt;/P&gt;

&lt;P&gt;Everything works great except pageName.  I'm not sure how to handle a field when I'm looking for two specific values.  If I search for just one page, I can do: | count(pageName) and it works great.&lt;BR /&gt;&lt;BR /&gt;
Appreciate the input!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:10:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496397#M194649</guid>
      <dc:creator>rick4039</dc:creator>
      <dc:date>2020-09-30T03:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help counting, the field, pageName, when I'm trying to count two or more specific values.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496398#M194650</link>
      <description>&lt;P&gt;maybe i am missing something, but have you tried the &lt;CODE&gt;eval&lt;/CODE&gt; with &lt;CODE&gt;OR&lt;/CODE&gt; ?&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;.... all your search ... | stats count(eval(pageName="Error : API Failure" OR pageName="Device : Device Wall")) as page_count .... more stuff&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 18:50:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496398#M194650</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2019-12-03T18:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help counting, the field, pageName, when I'm trying to count two or more specific values.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496399#M194651</link>
      <description>&lt;P&gt;Hi. I tried to solve this with some of the data I have in my lab. You could try using sub-searches and appending the results to the outer search.&lt;BR /&gt;
First, sub-search does a timechart with a span of 5 minutes for the pageName field. The second sub-search does the average for responseTime by _time (like your original search). And lastly the outer search takes care of the responseCode field with the codes you specified, also a timechart with span=5m.&lt;BR /&gt;
The results for the two sub-searches get appended to the results for the outer search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index="webprod" sourcetype=json_auto_timestamp  serviceName="/api/more/auth" AND (responseCode=422 OR responseCode=500 OR responseCode=503 OR responseCode=504)
| fields responseCode
| timechart count(responseCode) span=5m by responseCode
| appendcols 
    [search index="webprod" sourcetype=json_auto_timestamp  serviceName="/api/more/auth" AND (pageName="Error : API Failure" OR pageName="Device : Device Wall")
    | fields pageName
    | timechart span=5m count(pageName) by pageName]
| appendcols
 [search index="webprod" sourcetype=json_auto_timestamp  serviceName="/api/more/auth"
 | fields responseTime
    | bin _time span=5m 
    | stats avg(responseTime) as RspTimeAvg
    by _time]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Dec 2019 20:12:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496399#M194651</guid>
      <dc:creator>oscar84x</dc:creator>
      <dc:date>2019-12-03T20:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help counting, the field, pageName, when I'm trying to count two or more specific values.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496400#M194652</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="webprod" AND sourcetype="json_auto_timestamp" AND serviceName="/api/more/auth" AND responseCode IN("422","500","503","504") AND (responseTime="*" OR pageName="Error : API Failure" OR pageName="Device : Device Wall")
| timechart limit=0 span=5m avg(responseTime) AS RspTimeAvg count(eval(responseCode==422)) AS 422 count(eval(responseCode==500)) AS 500 count(eval(responseCode==503)) AS 503 count(eval(responseCode==504)) AS 504 BY pageName
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Dec 2019 07:26:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496400#M194652</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-12-04T07:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help counting, the field, pageName, when I'm trying to count two or more specific values.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496401#M194653</link>
      <description>&lt;P&gt;Thanks! This is similar to what I was trying.  It would return 0 for the value of pageName.  If I did only one page per search, it would work but didn't seem to be able to handle two or more. &lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 14:09:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496401#M194653</guid>
      <dc:creator>rick4039</dc:creator>
      <dc:date>2019-12-04T14:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help counting, the field, pageName, when I'm trying to count two or more specific values.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496402#M194654</link>
      <description>&lt;P&gt;This worked great! I got the data I needed and I can see some interesting possiblities on using this approach for other types of data we want to analyze.  The only odd thing I discovered was when I selected job settings in search, "send to backlog" was grayed out.  But will need to keep the range of searches to a smaller time range and append the data to the csv.  Thanks again, this was great!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 14:14:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496402#M194654</guid>
      <dc:creator>rick4039</dc:creator>
      <dc:date>2019-12-04T14:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help counting, the field, pageName, when I'm trying to count two or more specific values.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496403#M194655</link>
      <description>&lt;P&gt;I didn't try this format.  I'll give it a try this morning when I'm back in Splunk.  Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 14:17:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496403#M194655</guid>
      <dc:creator>rick4039</dc:creator>
      <dc:date>2019-12-04T14:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: Help counting, the field, pageName, when I'm trying to count two or more specific values.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496404#M194656</link>
      <description>&lt;P&gt;Excellent! I'm glad it worked and glad to help. Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 14:35:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496404#M194656</guid>
      <dc:creator>oscar84x</dc:creator>
      <dc:date>2019-12-04T14:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help counting, the field, pageName, when I'm trying to count two or more specific values.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496405#M194657</link>
      <description>&lt;P&gt;I had a typo but I fixed it.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 18:23:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-counting-the-field-pageName-when-I-m-trying-to-count-two-or/m-p/496405#M194657</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-12-04T18:23:51Z</dc:date>
    </item>
  </channel>
</rss>

