<?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 count of the field whose value is greater than 0 ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-the-field-whose-value-is-greater-than-0/m-p/403873#M116859</link>
    <description>&lt;P&gt;if the info in the message is a result a running process and you want to get the latest status you can use latest(*) instead of count.  e.g.  &lt;CODE&gt;| timechart latest(total) as Total latest(processed) as processed latest(failed) as Failed&lt;/CODE&gt; &lt;BR /&gt;
Count doesn't seam to make much sense to me in that context, but I might by assuming something wrong. Can you give more details about the context that log is generated?&lt;/P&gt;</description>
    <pubDate>Wed, 10 Apr 2019 10:12:42 GMT</pubDate>
    <dc:creator>diogofgm</dc:creator>
    <dc:date>2019-04-10T10:12:42Z</dc:date>
    <item>
      <title>How to get the count of the field whose value is greater than 0 ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-the-field-whose-value-is-greater-than-0/m-p/403872#M116858</link>
      <description>&lt;P&gt;I have logs in Splunk which has a field named Message as Highligthed below &lt;/P&gt;

&lt;P&gt;Date = 2019-04-09 11:43:20,946 | Level = INFO  |  RequestID = (null) | ErrorCode = (null) | ErrorMessage = Records details  | Alert = false | &lt;STRONG&gt;&lt;EM&gt;Message = Manufacture:Actia;Total Records:20;Processed Records:18;Failed Records:2&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I need to extract Manufacture name , total records, processed records and failed records values and get the count of the records and display it in Bar chart&lt;/P&gt;

&lt;P&gt;Below is the query which i tried to generate the result &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index ="XYZ" "Failed Records" "Manufacture:Actia" |rex field=_raw "Total Records:(?\d+);Processed Records:(?\d+);Failed Records:(?\d+)" | timechart count(total) as Total, count(processed) as processed,count(failed) as Failed
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i need to get the count for the records&lt;BR /&gt;
Total Records :20&lt;BR /&gt;
Processed records : 18&lt;BR /&gt;
Failed Records: 2&lt;/P&gt;

&lt;P&gt;Please suggest.&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/6849i2E717486464A6D4D/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 04:52:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-the-field-whose-value-is-greater-than-0/m-p/403872#M116858</guid>
      <dc:creator>minaljain</dc:creator>
      <dc:date>2019-04-10T04:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the count of the field whose value is greater than 0 ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-the-field-whose-value-is-greater-than-0/m-p/403873#M116859</link>
      <description>&lt;P&gt;if the info in the message is a result a running process and you want to get the latest status you can use latest(*) instead of count.  e.g.  &lt;CODE&gt;| timechart latest(total) as Total latest(processed) as processed latest(failed) as Failed&lt;/CODE&gt; &lt;BR /&gt;
Count doesn't seam to make much sense to me in that context, but I might by assuming something wrong. Can you give more details about the context that log is generated?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 10:12:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-the-field-whose-value-is-greater-than-0/m-p/403873#M116859</guid>
      <dc:creator>diogofgm</dc:creator>
      <dc:date>2019-04-10T10:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the count of the field whose value is greater than 0 ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-the-field-whose-value-is-greater-than-0/m-p/403874#M116860</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="Date = 2019-04-09 11:43:20,946 | Level = INFO | RequestID = | ErrorCode = | ErrorMessage = Records details | Alert = false | Message = Manufacture:Actia;Total Records:20;Processed Records:18;Failed Records:2"
| extract pairdelim="|;" kvdelim="=:"
| eval _time=strptime(replace(Date,",","."),"%F %T.%3Q")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, folks.&lt;BR /&gt;
For structured logs, try &lt;CODE&gt;extract&lt;/CODE&gt;.&lt;BR /&gt;
Regex-free.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jan 2020 11:34:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-the-field-whose-value-is-greater-than-0/m-p/403874#M116860</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-19T11:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the count of the field whose value is greater than 0 ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-the-field-whose-value-is-greater-than-0/m-p/403875#M116861</link>
      <description>&lt;P&gt;Step 1: get your field extractions straight globally for this sourcetype (so you don't need to do the &lt;CODE&gt;rex&lt;/CODE&gt;).  Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index ="XYZ" AND sourcetype="SomeSourcetypeHere" AND "Failed Records" AND "Manufacture:Actia"
| rex "Total Records:\s*(?&amp;lt;TotalRecords&amp;gt;\d+);\s*Processed Records:\s*(?&amp;lt;ProcessedRecords&amp;gt;\d+);\s*Failed Records:\s*(?&amp;lt;FailedRecords&amp;gt;\d+)"
| timechart count AS EventCount, sum(TotalRecords) AS Total, sum(ProcessedRecords) AS Processed, sum(FailedRecords) AS Failed
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Possibly, depending on how your events are generated (what they mean), you might need &lt;CODE&gt;max&lt;/CODE&gt; instead of &lt;CODE&gt;sum&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jan 2020 22:21:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-the-field-whose-value-is-greater-than-0/m-p/403875#M116861</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-01-19T22:21:27Z</dc:date>
    </item>
  </channel>
</rss>

