<?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: Help with Stats count expression?? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532413#M150406</link>
    <description>&lt;P&gt;So, if your 4th action is as described, but you still want the delivery mechanism, then either of these two will work - using a different technique to demonstrate the are of the possible &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=mfa sourcetype=lexus Subcategory="Delivery Method"
| rex field=action "(User choose to answer security|User selected) (?&amp;lt;mode&amp;gt;\w+) (delivery|questions)"
| stats count by mode&lt;/LI-CODE&gt;&lt;P&gt;OR this using an eval technique&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=mfa sourcetype=lexus Subcategory="Delivery Method"
| rex field=action "User selected (?&amp;lt;mode&amp;gt;\w+) delivery"
| eval mode=if(!isnull(mode), mode, if(match(action, "User choose to answer security questions"), "security", "unknown"))
| stats count by mode&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;usage comes down to preference/your data and whether this will work well if your data changes. The above will set mode for the most common case, then test if it's not set and evaluate the new security question condition and return unknown if it does not match that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Dec 2020 02:15:24 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2020-12-09T02:15:24Z</dc:date>
    <item>
      <title>Help with Stats count expression??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532257#M150354</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I'm newer-ish to splunk.&amp;nbsp; I'm doing a search similar to this in splunk : index=mfa sourcetype=lexus Subcategory="Delivery Method".&lt;/P&gt;&lt;P&gt;With the search results, I want to do stats count by action, but It brings back results similar to this(see below), with each action having a different phone number. How do I get stats only on the wording "User selected text Deilvery"? and not having 1 stat for every phone number.&amp;nbsp; There are 100 actions with the different phone numbers. I just want a count by User selected text delivery.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;"User selected text delivery to ***-***-****"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this makes sense. I'll gladly provide more info if needed. i'm just pretty new to this, and looking for some help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 00:26:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532257#M150354</guid>
      <dc:creator>kfinn</dc:creator>
      <dc:date>2020-12-08T00:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Stats count expression??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532260#M150355</link>
      <description>&lt;P&gt;Use this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=mfa sourcetype=lexus Subcategory="Delivery Method"
| rex field=action mode=sed "s/(User selected text delivery).*/\1/"&lt;/LI-CODE&gt;&lt;P&gt;It won't change your other actions.&lt;/P&gt;&lt;P&gt;There are other ways to achieve the same end, but this is an easy option. See rex command doc&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.0/SearchReference/Rex" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.1.0/SearchReference/Rex&lt;/A&gt;&lt;/P&gt;&lt;P&gt;it's a useful command for extracting new fields from existing fields, but also in this case to replace text.&lt;/P&gt;&lt;P&gt;Another option would be to use | eval+replace - see the docs for that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 00:34:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532260#M150355</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-12-08T00:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Stats count expression??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532265#M150359</link>
      <description>&lt;P&gt;I have done this, but it just brings back all the events, including other actions in that Subcategory, not just text.&lt;/P&gt;&lt;P&gt;Am I missing something?&lt;/P&gt;&lt;P&gt;index=mfa sourcetype=lexus Subcategory="Delivery Method"&lt;BR /&gt;| rex field=action mode=sed "s/(User selected text delivery).*/\1/"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once I get this working. I can do stats count by action? or something else to get the count?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 01:29:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532265#M150359</guid>
      <dc:creator>kfinn</dc:creator>
      <dc:date>2020-12-08T01:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Stats count expression??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532269#M150360</link>
      <description>&lt;P&gt;So when you say you want to 'count by action', it sounds you are only interested in one specific action right and want only to show text delivery actions within the subcategory&amp;nbsp;&lt;SPAN&gt;"Delivery Method"?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In that case, just restrict the search for &lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;action="User selected text delivery*"&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;and then just | stats count.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Or maybe I still don't understand what you want. If not, perhaps you can be a bit clearer on what data you have and what specific results you need to see.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 02:29:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532269#M150360</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-12-08T02:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Stats count expression??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532274#M150363</link>
      <description>&lt;P&gt;Thanks, that helps.&lt;/P&gt;&lt;P&gt;Sorry for not being more clear. Ultimately, within the Subcategory=Delivery Method. There are these 3&amp;nbsp; actions, that I'm trying to get "stats" on. Counts on. To search and then put into panel dashboard.&lt;/P&gt;&lt;P&gt;Wondering what the search would look like to search and get counts on all 3 actions. When I do a stats count by action, it includes the phone number or email address.&amp;nbsp; I want counts of each, not a total of all 3. I hope this makes more sense. I'll gladly explain more if needed.&lt;/P&gt;&lt;P&gt;Again appreciate your assistance. Still trying to get better with this stuff.&lt;/P&gt;&lt;P&gt;User selected email delivery&lt;/P&gt;&lt;P&gt;User selected text delivery&lt;/P&gt;&lt;P&gt;User selected voice delivery&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 03:03:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532274#M150363</guid>
      <dc:creator>kfinn</dc:creator>
      <dc:date>2020-12-08T03:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Stats count expression??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532307#M150372</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229518"&gt;@kfinn&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what you want is this I expect&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=mfa sourcetype=lexus Subcategory="Delivery Method"
| rex field=action "User selected (?&amp;lt;mode&amp;gt;\w+) delivery"
| stats count by mode&lt;/LI-CODE&gt;&lt;P&gt;The rex statement will extract a new field (mode) using the regular expression, which will be one of text, email or voice and then the by clause in stats will do the appropriate grouping.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 09:24:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532307#M150372</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-12-08T09:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Stats count expression??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532343#M150380</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;This seems to have worked quite well. One last question. There is one more action, "User choose to answer security questions"&lt;/P&gt;&lt;P&gt;| rex field=action "User choose to answer (?&amp;lt;mode&amp;gt;\w+)"&lt;/P&gt;&lt;P&gt;This picks up security. What in the expression do I need to add so it will pick up security questions as the action and show like that in the group by mode results?&lt;/P&gt;&lt;P&gt;Thanks again for the help. I'm learning quite a bit about this stuff.&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 14:57:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532343#M150380</guid>
      <dc:creator>kfinn</dc:creator>
      <dc:date>2020-12-08T14:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Stats count expression??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532413#M150406</link>
      <description>&lt;P&gt;So, if your 4th action is as described, but you still want the delivery mechanism, then either of these two will work - using a different technique to demonstrate the are of the possible &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=mfa sourcetype=lexus Subcategory="Delivery Method"
| rex field=action "(User choose to answer security|User selected) (?&amp;lt;mode&amp;gt;\w+) (delivery|questions)"
| stats count by mode&lt;/LI-CODE&gt;&lt;P&gt;OR this using an eval technique&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=mfa sourcetype=lexus Subcategory="Delivery Method"
| rex field=action "User selected (?&amp;lt;mode&amp;gt;\w+) delivery"
| eval mode=if(!isnull(mode), mode, if(match(action, "User choose to answer security questions"), "security", "unknown"))
| stats count by mode&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;usage comes down to preference/your data and whether this will work well if your data changes. The above will set mode for the most common case, then test if it's not set and evaluate the new security question condition and return unknown if it does not match that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 02:15:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Stats-count-expression/m-p/532413#M150406</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-12-09T02:15:24Z</dc:date>
    </item>
  </channel>
</rss>

