<?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 can I bring up the top 10 errors in Pivot view? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-bring-up-the-top-10-errors-in-Pivot-view/m-p/431930#M123437</link>
    <description>&lt;P&gt;@sarathipattam, Try the following search. The field message in Splunk's _internal index is actually &lt;CODE&gt;hdr.msg&lt;/CODE&gt; for your. Also the reason I used &lt;CODE&gt;substr()&lt;/CODE&gt; in my example was to restrict the number of characters in message field as the same will be displayed as column header. If you wish to retain 1000 characters, it would be too long.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=stores_servers sourcetype=json 
[search index=stores_servers sourcetype=json hdr.level="Critical" "hdr.msg"="*" earliest=-7d@d latest=now
| top 10 "hdr.msg" showperc=f showcount=f
| table "hdr.msg"] earliest=-7d@d latest=now
| eval Time=strftime(_time,"%Y/%m/%d")
| eval "hdr.msg" =substr('hdr.msg',0,100)
| chart count as ErrorCount by hdr.msg Time
| addtotals row=t col=f
| sort - Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have done a change in subsearch and added &lt;CODE&gt;"hdr.msg"="*"&lt;/CODE&gt; condition to ensure that we get only the events with "hdr.msg" field in it.&lt;/P&gt;

&lt;P&gt;Please try out and confirm!&lt;/P&gt;</description>
    <pubDate>Wed, 30 May 2018 21:09:07 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2018-05-30T21:09:07Z</dc:date>
    <item>
      <title>How can I bring up the top 10 errors in Pivot view?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-bring-up-the-top-10-errors-in-Pivot-view/m-p/431927#M123434</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm trying to pull top 10 errors for last 7 days and I would like to show each error counts on each day. Pls see the query details below,&lt;/P&gt;

&lt;P&gt;Below is my query for top 10 errors,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=stores_servers hdr.level="Error"
| eval _time=strftime(_time,"%Y-%m-%d")
| rename bdy.msg AS msg
| chart count over _time by msg useother=f| head 10 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results for above query is below,&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5100iF8FCFF587692488C/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Expected Results:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5101i92F4BA3F090D0F00/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Can someone help me on how to get the expected results in Splunk please?&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 16:55:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-bring-up-the-top-10-errors-in-Pivot-view/m-p/431927#M123434</guid>
      <dc:creator>sarathipattam</dc:creator>
      <dc:date>2018-05-30T16:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can I bring up the top 10 errors in Pivot view?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-bring-up-the-top-10-errors-in-Pivot-view/m-p/431928#M123435</link>
      <description>&lt;P&gt;@sarathipattam if you want to plot the top 10 errors that have occurred in last 7 days and break out their occurrence daily, you should try a different search. Your current search plots daily count of errors broken down daily and gives your first 10 days (if you are selecting last 7 days, you will always get 7 rows).&lt;/P&gt;

&lt;P&gt;Try the following run anywhere search which finds out Splunk's _internal logs top 10 errors/warnings in last 7 days and breaks out the daily distribution of errors.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd 
    [search index=_internal sourcetype=splunkd log_level!=INFO earliest=-7d@d latest=now
|  top 10 message showperc=f showcount=f
|  table message] earliest=-7d@d latest=now
|  eval Time=strftime(_time,"%Y/%m/%d")
|  eval message=substr(message,0,100)
|  chart count as ErrorCount by message Time
|  addtotals row=t col=f
|  sort - Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5099i0FBC5127219A3F47/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Following is the Simple XML dashboard code for the screen mock up:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Top 10 error messages in last 7 days&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="time" token="tokTime" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-7d@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=splunkd 
    [search index=_internal sourcetype=splunkd log_level!=INFO earliest=$tokTime.earliest$ latest=$tokTime.latest$
|  top 10 message showperc=f showcount=f
|  table message]
|  eval Time=strftime(_time,"%Y/%m/%d")
|  eval message=substr(message,0,100)
|  chart count as ErrorCount by message Time
|  addtotals row=t col=f
|  sort - Total&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$tokTime.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$tokTime.latest$&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="totalsRow"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 May 2018 18:07:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-bring-up-the-top-10-errors-in-Pivot-view/m-p/431928#M123435</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-05-30T18:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: How can I bring up the top 10 errors in Pivot view?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-bring-up-the-top-10-errors-in-Pivot-view/m-p/431929#M123436</link>
      <description>&lt;P&gt;Hi niketnilay ,&lt;/P&gt;

&lt;P&gt;Thank you for the response, I tried your query as below,&lt;/P&gt;

&lt;P&gt;index=stores_servers sourcetype=json &lt;BR /&gt;
     [search index=stores_servers sourcetype=json hdr.level="Critical" earliest=-7d@d latest=now&lt;BR /&gt;
 |  top 10 hdr.msg showperc=f showcount=f&lt;BR /&gt;
 |  table hdr.msg] earliest=-7d@d latest=now&lt;BR /&gt;
 |  eval Time=strftime(_time,"%Y/%m/%d")&lt;BR /&gt;
 |  eval message=substr(hdr.msg,0,1000)&lt;BR /&gt;
 |  chart count as ErrorCount by message Time&lt;BR /&gt;
 |  addtotals row=t col=f&lt;BR /&gt;
 |  sort - Total &lt;/P&gt;

&lt;P&gt;and I ended up with blank results. Can you tell me where I'm missing please?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:47:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-bring-up-the-top-10-errors-in-Pivot-view/m-p/431929#M123436</guid>
      <dc:creator>sarathipattam</dc:creator>
      <dc:date>2020-09-29T19:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: How can I bring up the top 10 errors in Pivot view?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-bring-up-the-top-10-errors-in-Pivot-view/m-p/431930#M123437</link>
      <description>&lt;P&gt;@sarathipattam, Try the following search. The field message in Splunk's _internal index is actually &lt;CODE&gt;hdr.msg&lt;/CODE&gt; for your. Also the reason I used &lt;CODE&gt;substr()&lt;/CODE&gt; in my example was to restrict the number of characters in message field as the same will be displayed as column header. If you wish to retain 1000 characters, it would be too long.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=stores_servers sourcetype=json 
[search index=stores_servers sourcetype=json hdr.level="Critical" "hdr.msg"="*" earliest=-7d@d latest=now
| top 10 "hdr.msg" showperc=f showcount=f
| table "hdr.msg"] earliest=-7d@d latest=now
| eval Time=strftime(_time,"%Y/%m/%d")
| eval "hdr.msg" =substr('hdr.msg',0,100)
| chart count as ErrorCount by hdr.msg Time
| addtotals row=t col=f
| sort - Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have done a change in subsearch and added &lt;CODE&gt;"hdr.msg"="*"&lt;/CODE&gt; condition to ensure that we get only the events with "hdr.msg" field in it.&lt;/P&gt;

&lt;P&gt;Please try out and confirm!&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 21:09:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-bring-up-the-top-10-errors-in-Pivot-view/m-p/431930#M123437</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-05-30T21:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can I bring up the top 10 errors in Pivot view?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-bring-up-the-top-10-errors-in-Pivot-view/m-p/431931#M123438</link>
      <description>&lt;P&gt;Thank you Niketnilay, it worked.&lt;/P&gt;</description>
      <pubDate>Thu, 31 May 2018 21:00:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-bring-up-the-top-10-errors-in-Pivot-view/m-p/431931#M123438</guid>
      <dc:creator>sarathipattam</dc:creator>
      <dc:date>2018-05-31T21:00:36Z</dc:date>
    </item>
  </channel>
</rss>

