<?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 extract the HTTP Status Code? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-HTTP-Status-Code/m-p/419346#M120575</link>
    <description>&lt;P&gt;Thank you that fixed my problem. To answer your question yes something like those examples are at the very end of every log it is formatted in IIS logging.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2019 14:10:53 GMT</pubDate>
    <dc:creator>bryceweb22</dc:creator>
    <dc:date>2019-06-12T14:10:53Z</dc:date>
    <item>
      <title>How to extract the HTTP Status Code?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-HTTP-Status-Code/m-p/419343#M120572</link>
      <description>&lt;P&gt;I need help with extracting and graphing the HTTP status code which is always the end of every log formatted as;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`200 0 0 140 or 403 0 0 455`
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;wherein those two examples the 200 and the 403 represent just two types of many different status codes. &lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 21:21:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-HTTP-Status-Code/m-p/419343#M120572</guid>
      <dc:creator>bryceweb22</dc:creator>
      <dc:date>2019-06-11T21:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the HTTP Status Code?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-HTTP-Status-Code/m-p/419344#M120573</link>
      <description>&lt;P&gt;if there is a prefix it would be very easy, you can do something like this in props.conf &lt;CODE&gt;"prefix : (?&amp;lt;status_code&amp;gt;\d+)"&lt;/CODE&gt;&lt;BR /&gt;
else you will have to white list all the expected status codes in props.conf and use them something like this &lt;CODE&gt;&lt;A href="https://answers.splunk.com/answers/319823/how-to-configure-propsconf-and-transformsconf-to-o.html" target="test_blank"&gt;https://answers.splunk.com/answers/319823/how-to-configure-propsconf-and-transformsconf-to-o.html&lt;/A&gt;&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 23:44:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-HTTP-Status-Code/m-p/419344#M120573</guid>
      <dc:creator>pruthvikrishnap</dc:creator>
      <dc:date>2019-06-11T23:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the HTTP Status Code?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-HTTP-Status-Code/m-p/419345#M120574</link>
      <description>&lt;P&gt;something like 200 0 0 140 or 403 0 0 455 is the end of every line?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;-&amp;gt; add in props.conf in your apache Sourcetype:
EXTRACT-http_statuscode = (?&amp;lt;statuscode&amp;gt;\d+)\s\d+\s\d+\s\d+$

-&amp;gt; If your data is already in Splunk, you can use this in your search to test it:
&amp;lt;your search&amp;gt; | rex field=_raw "(?&amp;lt;statuscode&amp;gt;\d+)\s\d+\s\d+\s\d+$"

-&amp;gt; explanation:
&lt;A href="https://regex101.com/r/ct4C7D/1" target="test_blank"&gt;https://regex101.com/r/ct4C7D/1&lt;/A&gt;

-&amp;gt; After extracting the field (either in props.conf or in your search) you can use
&amp;lt;your search and extraction&amp;gt; | timechart count by statuscode
or
&amp;lt;your search and extraction&amp;gt; | stats count by statuscode

 -&amp;gt; or use Splunk built in extractions for default access logs
 &amp;lt;your search&amp;gt; | extract access-extractions | stats count by statuscode
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jun 2019 07:01:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-HTTP-Status-Code/m-p/419345#M120574</guid>
      <dc:creator>hmarkus</dc:creator>
      <dc:date>2019-06-12T07:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the HTTP Status Code?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-HTTP-Status-Code/m-p/419346#M120575</link>
      <description>&lt;P&gt;Thank you that fixed my problem. To answer your question yes something like those examples are at the very end of every log it is formatted in IIS logging.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 14:10:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-HTTP-Status-Code/m-p/419346#M120575</guid>
      <dc:creator>bryceweb22</dc:creator>
      <dc:date>2019-06-12T14:10:53Z</dc:date>
    </item>
  </channel>
</rss>

