<?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 How to return status codes from interesting field to a bar chart? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-status-codes-from-interesting-field-to-a-bar-chart/m-p/442229#M172441</link>
    <description>&lt;P&gt;i am running a basic search:&lt;/P&gt;

&lt;P&gt;index=apigee host="mock" "apiproxy.name"=GetQuoteServices_v1_Manual ("error.status.code"=400 OR "error.status.code"=401 OR "error.status.code"=403 OR "error.status.code"=404 OR "error.status.code"=429 OR "error.status.code"=500 OR "error.status.code"=502 OR "error.status.code"=503 OR "error.status.code"=504 OR statuscode!=200) &lt;/P&gt;

&lt;P&gt;I would like to push the output of this search to a bar graph so it is easy to view from a dashboard.  The bar graph should have a bar for each status code.  Below is what I am using but all I get is 2 bars in it with one bar being the "400" status code and the other just being blank :&lt;/P&gt;

&lt;P&gt;| top limit=0 statuscode | fields statuscode count&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 23:42:45 GMT</pubDate>
    <dc:creator>sdickerson</dc:creator>
    <dc:date>2020-09-29T23:42:45Z</dc:date>
    <item>
      <title>How to return status codes from interesting field to a bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-status-codes-from-interesting-field-to-a-bar-chart/m-p/442229#M172441</link>
      <description>&lt;P&gt;i am running a basic search:&lt;/P&gt;

&lt;P&gt;index=apigee host="mock" "apiproxy.name"=GetQuoteServices_v1_Manual ("error.status.code"=400 OR "error.status.code"=401 OR "error.status.code"=403 OR "error.status.code"=404 OR "error.status.code"=429 OR "error.status.code"=500 OR "error.status.code"=502 OR "error.status.code"=503 OR "error.status.code"=504 OR statuscode!=200) &lt;/P&gt;

&lt;P&gt;I would like to push the output of this search to a bar graph so it is easy to view from a dashboard.  The bar graph should have a bar for each status code.  Below is what I am using but all I get is 2 bars in it with one bar being the "400" status code and the other just being blank :&lt;/P&gt;

&lt;P&gt;| top limit=0 statuscode | fields statuscode count&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:42:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-status-codes-from-interesting-field-to-a-bar-chart/m-p/442229#M172441</guid>
      <dc:creator>sdickerson</dc:creator>
      <dc:date>2020-09-29T23:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to return status codes from interesting field to a bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-status-codes-from-interesting-field-to-a-bar-chart/m-p/442230#M172442</link>
      <description>&lt;P&gt;Hello&lt;BR /&gt;
I am sure that the problem is with your main search. fields error.status.code and statuscode is in one event?&lt;BR /&gt;
if yes, then both field contains the same values? if yes then use &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=apigee host="mock" "apiproxy.name"=GetQuoteServices_v1_Manual ("error.status.code"=400 OR "error.status.code"=401 OR "error.status.code"=403 OR "error.status.code"=404 OR "error.status.code"=429 OR "error.status.code"=500 OR "error.status.code"=502 OR "error.status.code"=503 OR "error.status.code"=504)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;otherwise &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=apigee host="mock" "apiproxy.name"=GetQuoteServices_v1_Manual ("error.status.code"=400 OR "error.status.code"=401 OR "error.status.code"=403 OR "error.status.code"=404 OR "error.status.code"=429 OR "error.status.code"=500 OR "error.status.code"=502 OR "error.status.code"=503 OR "error.status.code"=504)  statuscode!=200
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If both the fields are not in one event and as your query is based on statuscode only then error.status.code field is irrelevant over here. &lt;BR /&gt;
To troubleshoot your query you should look into raw data only. so look at the values of both the fields and us e boolean operators (OR,NOT,AND) accordingly.&lt;/P&gt;

&lt;P&gt;Also on the reporting side use &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| top limit=0 statuscode  showperc=f&lt;/CODE&gt; to avoid using unnecessary command &lt;CODE&gt;fields&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 23:35:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-status-codes-from-interesting-field-to-a-bar-chart/m-p/442230#M172442</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-03-15T23:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to return status codes from interesting field to a bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-status-codes-from-interesting-field-to-a-bar-chart/m-p/442231#M172443</link>
      <description>&lt;P&gt;Thanks for the advice! With what you provided and Splunk Documentation I was able to get the following search to work:&lt;/P&gt;

&lt;P&gt;index=apigee host="mock" "apiproxy.name"=GetQuoteServices_v1_Manual error.status.code IN (400, 401, 402, 403, 404) | top limit=0 error.status.code showperc=f&lt;/P&gt;

&lt;P&gt;The issue is when trying to combine it with the almost the exact same search to get the 200 responses does not seem to work. The 200 responses are under a different interesting field so this is where it gets hairy. I attempted the following with no luck:&lt;/P&gt;

&lt;P&gt;multisearch [search index=apigee host="mock" "apiproxy.name"=GetQuoteServices_v1_Manual error.status.code IN (400, 401, 403, 404, 500, 502, 503, 504)] | eval type="error_search" [search index=apigee host="mock" "apiproxy.name"=GetQuoteServices_v1_Manual response.status.code IN (200, 201, 202, 203)] | eval type="success_search"&lt;/P&gt;

&lt;P&gt;I am assuming there is some sort of operator to use so the search is aware to run both searches but as of this point I have not had much luck. Any thoughts?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:43:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-status-codes-from-interesting-field-to-a-bar-chart/m-p/442231#M172443</guid>
      <dc:creator>sdickerson</dc:creator>
      <dc:date>2020-09-29T23:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to return status codes from interesting field to a bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-status-codes-from-interesting-field-to-a-bar-chart/m-p/442232#M172444</link>
      <description>&lt;P&gt;So I was able to get the search working with the coalesce option:&lt;/P&gt;

&lt;P&gt;index=apigee host=mock | eval xStatuscode=coalesce(tonumber('response.status.code'),tonumber('error.status.code'),tonumber('statuscode')) | top limit=0 xStatuscode showperc=f&lt;/P&gt;

&lt;P&gt;This will show all status codes and chart them out in a nice visualization.  Thanks again for your assistance.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2019 12:20:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-status-codes-from-interesting-field-to-a-bar-chart/m-p/442232#M172444</guid>
      <dc:creator>sdickerson</dc:creator>
      <dc:date>2019-03-19T12:20:06Z</dc:date>
    </item>
  </channel>
</rss>

