<?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: Table containing url, total requests, error responses in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509927#M142552</link>
    <description>&lt;P&gt;&amp;gt;&lt;SPAN&gt;search canceled message.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;what's this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;we can't see your display, so you should provide exactly messages.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 19 Jul 2020 21:30:42 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-07-19T21:30:42Z</dc:date>
    <item>
      <title>Table containing url, total requests, error responses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509836#M142517</link>
      <description>&lt;P&gt;Seems pretty simple, but it's kicking my butt so here I am. I've tried more variations than I'd like, but I have a ton of log writes. some of them are response values. What I'd like to do is create a simple table displaying the URL, its total number of incoming requests, and its total number of error responses. I can't get the error responses to work properly.&lt;/P&gt;&lt;P&gt;In the latest iteration, this is what I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;... line.status != "" | stats count as total_requests by line.url | eventstats count(eval(line.status!="200")) as errors by line.url&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;line.status doesn't exist on ever log write, of course, so I want to search only on log writes that document a response - for those, line.status will exist. total_requests works as expected, but errors does not. Ideally, errors could be a count where line.status &amp;gt; 399, but the value is a string and nothing I've tried has worked properly. I either get a query error, a 0 value, or a 1 value for all line.url values.&lt;/P&gt;&lt;P&gt;Where am I going wrong here?&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 14:55:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509836#M142517</guid>
      <dc:creator>oompaloompa</dc:creator>
      <dc:date>2020-07-18T14:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Table containing url, total requests, error responses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509841#M142519</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count as total_requests, count(eval(tonumber(line.status)&amp;gt;399)) as errors by line.url&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 15:23:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509841#M142519</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2020-07-18T15:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: Table containing url, total requests, error responses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509846#M142522</link>
      <description>&lt;P&gt;The error count is still zero on all urls using this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;line.status != "" | stats count as total_requests, count(eval(tonumber(line.status)&amp;gt;399)) as errors by line.url | sort -"errors"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 15:49:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509846#M142522</guid>
      <dc:creator>oompaloompa</dc:creator>
      <dc:date>2020-07-18T15:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Table containing url, total requests, error responses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509847#M142523</link>
      <description>&lt;P&gt;not sure why it isn't working since I don't have the raw data, you could try this alternative&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval error=if(tonumber(line.status)&amp;gt;399, 1, 0)
| stats count as total_requests, sum(error) as errors by line.url 
| sort -"errors"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;If this isn't working, check if error is being set properly in the eval.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 15:53:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509847#M142523</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2020-07-18T15:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Table containing url, total requests, error responses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509851#M142524</link>
      <description>&lt;P class="lia-align-left"&gt;Same 0 error count for all URLs. If I break it down by url _and_ status, I also see an error count of 0, even when the line.status value in a given row is &amp;gt; 399:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count as total_requests, count(eval(tonumber(line.status)&amp;gt;399)) as errors by line.url, line.status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In that query, for any row whose line.status value is &amp;lt; 399, I'd expect the value of the errors field to match that of the total_requests field, right?&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 16:06:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509851#M142524</guid>
      <dc:creator>oompaloompa</dc:creator>
      <dc:date>2020-07-18T16:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: Table containing url, total requests, error responses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509858#M142527</link>
      <description>&lt;P&gt;Even this returns all zeros:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval foo=if(tonumber(line.status) &amp;gt; 399, 1, 0) | table foo&lt;/LI-CODE&gt;&lt;P&gt;I'm not sure how much simpler of a case I can try. I've also tried these variants just to see if i could isolate a _specific_ error status code.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval foo=if(tonumber(line.status="401"), 1, 0) | table foo
// all zeros

| eval foo=if(line.status=401, 1, 0) | table foo
// Error in 'eval' command: Type checking failed. The '==' operator received different types.&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 18 Jul 2020 18:02:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509858#M142527</guid>
      <dc:creator>oompaloompa</dc:creator>
      <dc:date>2020-07-18T18:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Table containing url, total requests, error responses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509870#M142533</link>
      <description>&lt;P&gt;I think I've found something that gets me the raw data I'm after, but could use a sanity check.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;... | stats count as status_code_count by line.url, line.status | eventstats sum(status_code_count) as total_hits by line.url | eval status_code_percent=round((status_code_count/total_hits)*100, 2) | fields line.url, line.status, total_hits, status_code_percent | sort + line.url, + line.status, - status_code_percent&lt;/LI-CODE&gt;&lt;P&gt;The last thing I'd like to do is filter for line.status values &amp;gt; 399 (errors), but I still can't find the magic touch for that. I've tried&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where tonumber(line.status)&amp;gt;399
// No results

| where line.status="500"
// No results

| where line.status=500
// Type mismatch error&lt;/LI-CODE&gt;&lt;P&gt;Something definitely seems to be wrong with either my status data or the way I'm trying to query it, but I can't find the key for the life of me.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 21:25:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509870#M142533</guid>
      <dc:creator>oompaloompa</dc:creator>
      <dc:date>2020-07-18T21:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Table containing url, total requests, error responses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509874#M142536</link>
      <description>&lt;P&gt;please provide sample logs. your fields extraction is maybe wrong.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 01:40:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509874#M142536</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-19T01:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: Table containing url, total requests, error responses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509897#M142543</link>
      <description>&lt;P&gt;Here is an example log line from the base query which is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="&amp;lt;redacted&amp;gt;" "attrs.app"="api" attrs.stack="prod" line.component="gateway" line.message="request completed"&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;{   
   "line": {      
      "level":"info",
      "component":"gateway",
      "elapsed-time":5.548328,
      "request-id":"c52e5e50-fb15-4a37-96ba-17e208e947ee",
      "status":200,
      "method":"GET",
      "path":"/beneinfo/keep-alive",
      "url":"/beneinfo/keep-alive",
      "trimmed path":"public",
      "query":"",
      "error message":"",
      "error details":[],
      "pid":1,
      "te":"",
      "serve local docs":false,
      "time":"2020-07-19T14:49:55.633253281Z",
      "message":"request completed"
   },
   "source":"stderr",
   "attrs":{
      "app":"api",
      "stack":"prod"
   }
}&lt;/LI-CODE&gt;&lt;P&gt;Would definitely appreciate any thoughts you might have.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 15:02:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509897#M142543</guid>
      <dc:creator>oompaloompa</dc:creator>
      <dc:date>2020-07-19T15:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Table containing url, total requests, error responses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509910#M142547</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal | head 1 | fields _time _raw | eval _raw="{\"line\":{\"level\":\"info\",\"component\":\"gateway\",\"elapsed-time\":5.548328,\"request-id\":\"c52e5e50-fb15-4a37-96ba-17e208e947ee\",\"status\":200,\"method\":\"GET\",\"path\":\"/beneinfo/keep-alive\",\"url\":\"/beneinfo/keep-alive\",\"trimmed path\":\"public\",\"query\":\"\",\"error message\":\"\",\"error details\":[],\"pid\":1,\"te\":\"\",\"serve local docs\":false,\"time\":\"2020-07-19T14:49:55.633253281Z\",\"message\":\"request completed\"},\"source\":\"stderr\",\"attrs\":{\"app\":\"api\",\"stack\":\"prod\"}}"
| spath
| stats count by "line.status" "line.url"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;line.status&lt;/TD&gt;&lt;TD&gt;line.url&lt;/TD&gt;&lt;TD&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;/beneinfo/keep-alive&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;This query works fine.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="&amp;lt;redacted&amp;gt;" "attrs.app"="api" attrs.stack="prod" line.component="gateway" line.message="request completed"
| stats count by "line.status" "line.url"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this result doesn't have status over 399, there is not the error.&lt;BR /&gt;&lt;BR /&gt;If there are errors, add&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;| search "line.status" &amp;gt; 399&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 20:11:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509910#M142547</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-19T20:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Table containing url, total requests, error responses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509924#M142550</link>
      <description>&lt;P&gt;What you have here has always worked fine. I get a table of all status codes for each URL. What I can't seem to do is limit the output to &amp;gt; 399 only . Every attempt I make fails for one of the reasons mentioned above. If I through "| search line.status &amp;gt; 399" at it, then I get a search canceled message.&lt;/P&gt;&lt;P&gt;I can't seem to right the right fit to filter the working query above, nor can i find another way to do the same thing that limits the results to only error status codes.&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 21:14:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509924#M142550</guid>
      <dc:creator>oompaloompa</dc:creator>
      <dc:date>2020-07-19T21:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: Table containing url, total requests, error responses</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509927#M142552</link>
      <description>&lt;P&gt;&amp;gt;&lt;SPAN&gt;search canceled message.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;what's this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;we can't see your display, so you should provide exactly messages.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 21:30:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-containing-url-total-requests-error-responses/m-p/509927#M142552</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-19T21:30:42Z</dc:date>
    </item>
  </channel>
</rss>

