<?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 get the status code status code in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-status-code-status-code/m-p/443339#M171438</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=abc-a-fr-* source=*access..log* /api/*
| eval file=urldecode(file)
| where NOT match(file,"\d+$$$$")
| eval status=coalesce(status, "UNKNOWN")
| stats values(status) As Status count AS Total count(eval(status&amp;lt;=399)) AS Success BY file
| eval Failure = Total - Success
| eval Percent_Failure=round((Failure/Total) * 100, 1)
| eval Percent_Success=100 - Percent_Failure
| table file Status Total Success Percent_Success Percent_Failure
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 09 May 2019 15:28:59 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-05-09T15:28:59Z</dc:date>
    <item>
      <title>How to get the status code status code</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-status-code-status-code/m-p/443337#M171436</link>
      <description>&lt;P&gt;I have written the following query to calculate the number of response code with api and their respective http status and calculate the total number of failure and success count.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=abc-a-fr-* source=*access..log* /api/* |eval status1=status|eval file=urldecode(file)| stats count AS Total count(eval(status&amp;lt;=399)) AS Success BY file| eval Failure = Total - Success | eval Percent_Failure=round((Failure/ Total) * 100, 1)| eval Percent_Success=round((Success/ Total) * 100, 1) |table file Total Success Percent_Success Percent_Failure|where NOT match(file,"\d+$$$$")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And the following is the output&lt;BR /&gt;
file                   Total     Success         Percent_Success     Percent_Failure&lt;BR /&gt;
currencies  2                 0                    0.0            100.0&lt;BR /&gt;
OrderId         7                 0                   0.0                     100.0&lt;BR /&gt;
addressId     3               0                  0.0                      100.0&lt;BR /&gt;
deliveryslot    205961      5956                    2.9                    97.1&lt;/P&gt;

&lt;P&gt;If i group the count by status,if give me completely different data, what i would like to add is the status in the table, but when i put the status field in the table there is no data&lt;/P&gt;

&lt;P&gt;Below is what i would like to achieve&lt;BR /&gt;
file                         Status        Total     Success         Percent_Success     Percent_Failure&lt;BR /&gt;
currencies         503               2                0                  0.0                         100.0&lt;BR /&gt;
OrderId                401               7                0                  0.0                         100.0&lt;BR /&gt;
addressId              503              3                 0                  0.0                         100.0&lt;BR /&gt;
deliveryslot            400          205961     5956                     2.9                           97.1&lt;/P&gt;

&lt;P&gt;How do I achieve this, please help me&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:23:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-status-code-status-code/m-p/443337#M171436</guid>
      <dc:creator>mrafiq17</dc:creator>
      <dc:date>2020-09-30T00:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the status code status code</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-status-code-status-code/m-p/443338#M171437</link>
      <description>&lt;P&gt;Its because, status is removed at your stats command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=abc-a-fr-* source=*access..log* /api/* 
|eval status1=status
|eval file=urldecode(file)
| stats count AS Total count(eval(status&amp;lt;=399)) AS Success BY file, status
| eval Failure = Total - Success 
| eval Percent_Failure=round((Failure/ Total) * 100, 1)
| eval Percent_Success=round((Success/ Total) * 100, 1) 
|table file status Total Success Percent_Success Percent_Failure|where NOT match(file,"\d+$$$$")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 May 2019 21:55:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-status-code-status-code/m-p/443338#M171437</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2019-05-08T21:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the status code status code</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-status-code-status-code/m-p/443339#M171438</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=abc-a-fr-* source=*access..log* /api/*
| eval file=urldecode(file)
| where NOT match(file,"\d+$$$$")
| eval status=coalesce(status, "UNKNOWN")
| stats values(status) As Status count AS Total count(eval(status&amp;lt;=399)) AS Success BY file
| eval Failure = Total - Success
| eval Percent_Failure=round((Failure/Total) * 100, 1)
| eval Percent_Success=100 - Percent_Failure
| table file Status Total Success Percent_Success Percent_Failure
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 May 2019 15:28:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-status-code-status-code/m-p/443339#M171438</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-05-09T15:28:59Z</dc:date>
    </item>
  </channel>
</rss>

