<?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: Question on calculating statistics for a field with different values in one event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Question-on-calculating-statistics-for-a-field-with-different/m-p/491476#M137196</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = ...
| regular expression to catch error max_match=0
| stats count BY error
| lookup lookupfile_name error OUTPUT error_description comments
| search comments="medium"
| stats sum(count) AS count BY error_description
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 29 Mar 2020 16:03:05 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2020-03-29T16:03:05Z</dc:date>
    <item>
      <title>Question on calculating statistics for a field with different values in one event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-on-calculating-statistics-for-a-field-with-different/m-p/491472#M137192</link>
      <description>&lt;P&gt;I have a difficulty in calculating statistics when different (multiple) values are present for a field in the same event.&lt;BR /&gt;
My query now extract the error field (for which i have written the regular expression) and looks for the error and calculate count.&lt;BR /&gt;
How to overcome this..&lt;BR /&gt;
Please help!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 16:53:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-on-calculating-statistics-for-a-field-with-different/m-p/491472#M137192</guid>
      <dc:creator>prettysunshinez</dc:creator>
      <dc:date>2020-03-12T16:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: Question on calculating statistics for a field with different values in one event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-on-calculating-statistics-for-a-field-with-different/m-p/491473#M137193</link>
      <description>&lt;P&gt;You need to output one comment for each errors so expand &lt;STRONG&gt;error&lt;/STRONG&gt; values before running &lt;STRONG&gt;lookup&lt;/STRONG&gt;. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Index =  | regular expression to catch error max_match=0 | mvexpand error | lookup lookupfile_name error outputs error_description comments | search comments="$comment$" | stats count by error_description
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Mar 2020 20:12:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-on-calculating-statistics-for-a-field-with-different/m-p/491473#M137193</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-03-12T20:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Question on calculating statistics for a field with different values in one event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-on-calculating-statistics-for-a-field-with-different/m-p/491474#M137194</link>
      <description>&lt;P&gt;Thank You @manjunathmeti &lt;BR /&gt;
It worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I also have another question which is a kind of enhancement to the above query..&lt;/P&gt;

&lt;P&gt;In the lookup under Comments column I only have 3 catergories (For say : High,Medium,Low)&lt;BR /&gt;
And now based on the output of the above query (my initial question), if the error5 which is Low and when its count exceeds a certain limit (say 200) ,its Comment has to be changed as Medium.&lt;BR /&gt;
I'm have no clue as to how to start with it..&lt;BR /&gt;
Could you kindly help..&lt;/P&gt;</description>
      <pubDate>Sun, 29 Mar 2020 13:35:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-on-calculating-statistics-for-a-field-with-different/m-p/491474#M137194</guid>
      <dc:creator>prettysunshinez</dc:creator>
      <dc:date>2020-03-29T13:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: Question on calculating statistics for a field with different values in one event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-on-calculating-statistics-for-a-field-with-different/m-p/491475#M137195</link>
      <description>&lt;P&gt;This is what it &lt;EM&gt;should&lt;/EM&gt; do; what would you prefer that it do?&lt;/P&gt;</description>
      <pubDate>Sun, 29 Mar 2020 15:57:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-on-calculating-statistics-for-a-field-with-different/m-p/491475#M137195</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-29T15:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Question on calculating statistics for a field with different values in one event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-on-calculating-statistics-for-a-field-with-different/m-p/491476#M137196</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = ...
| regular expression to catch error max_match=0
| stats count BY error
| lookup lookupfile_name error OUTPUT error_description comments
| search comments="medium"
| stats sum(count) AS count BY error_description
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 29 Mar 2020 16:03:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-on-calculating-statistics-for-a-field-with-different/m-p/491476#M137196</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-29T16:03:05Z</dc:date>
    </item>
  </channel>
</rss>

