<?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: field extraction based onmore than one static strings and find out count in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/field-extraction-based-onmore-than-one-static-strings-and-find/m-p/233705#M188447</link>
    <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex max_match=0 "(?&amp;lt;message&amp;gt;(?:first message string)|(?:second message string)|(?:third message string)|(?:fourth message string)|(?:fifth message string)|(?:sixth message string)|(?:seventh message string))" | stats count by message
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Tack on &lt;CODE&gt;| fields - count&lt;/CODE&gt; to get  just the list of messages.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Sep 2015 14:54:24 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-09-23T14:54:24Z</dc:date>
    <item>
      <title>field extraction based onmore than one static strings and find out count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-extraction-based-onmore-than-one-static-strings-and-find/m-p/233700#M188442</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am new to Splunk.  I am trying to create a splunk query to find out the count of occurrence for a specific set of messages in a log file.&lt;/P&gt;

&lt;P&gt;E.g, there are 7 messages  "message1" "Message2" "Message3".... Message7. I need to create a table in the below format.&lt;/P&gt;

&lt;P&gt;Message         Count&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;message1          2&lt;BR /&gt;
Message2          0&lt;BR /&gt;
message3          0&lt;BR /&gt;
message4          1&lt;BR /&gt;
.....&lt;BR /&gt;
.....&lt;BR /&gt;
message7          4&lt;/P&gt;

&lt;P&gt;Also, I want to create a dropdown with the 7 message values. When I select a message I need to get the entry for that message. An all option in the dropdown to get all message counts.&lt;/P&gt;

&lt;P&gt;Can we use regex for this purpose? or any other suggestions to achieve this. The messages will be appearing in different part of the event. I want to avoid repeated "messages" in the same event&lt;BR /&gt;
Please help in this.&lt;/P&gt;

&lt;P&gt;Thanks in advance,&lt;BR /&gt;
Jyo&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2015 09:21:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-extraction-based-onmore-than-one-static-strings-and-find/m-p/233700#M188442</guid>
      <dc:creator>jyothishtj</dc:creator>
      <dc:date>2015-09-23T09:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: field extraction based onmore than one static strings and find out count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-extraction-based-onmore-than-one-static-strings-and-find/m-p/233701#M188443</link>
      <description>&lt;P&gt;Hi Jo&lt;/P&gt;

&lt;P&gt;For the field definition regex would be suggested. You can test your regex with | rex field=_raw "yourregex" | count by messages.&lt;BR /&gt;
If you name your field messages and then you get your table above. For help with your regex we would need an output of the log. &lt;/P&gt;

&lt;P&gt;The dropdown will be the next step after prober setting the regex in the probs.conf as field extraction. &lt;/P&gt;

&lt;P&gt;Bye&lt;BR /&gt;
Ben&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2015 11:02:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-extraction-based-onmore-than-one-static-strings-and-find/m-p/233701#M188443</guid>
      <dc:creator>benlc</dc:creator>
      <dc:date>2015-09-23T11:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: field extraction based onmore than one static strings and find out count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-extraction-based-onmore-than-one-static-strings-and-find/m-p/233702#M188444</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;You should use your query as  ....(your search condition ) | stats count by (message field name)    to get the count .&lt;/P&gt;

&lt;P&gt;To create a drop down in your dashboard you should use the dynamic option  to populate the drop down values and use a static for " all"  options and select its value as "*". You can write your search as ....(your search condition ) | dedup  (message field name) | field (message field name ) .  You can take a look into the below documentation  for more detail .&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Viz/Buildandeditforms"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Viz/Buildandeditforms&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Use tokens in dashboard panel drop down and control your search using the token.&lt;/P&gt;

&lt;P&gt;Hope it helps.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2015 11:29:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-extraction-based-onmore-than-one-static-strings-and-find/m-p/233702#M188444</guid>
      <dc:creator>badrinath_itrs</dc:creator>
      <dc:date>2015-09-23T11:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: field extraction based onmore than one static strings and find out count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-extraction-based-onmore-than-one-static-strings-and-find/m-p/233703#M188445</link>
      <description>&lt;P&gt;The problem is the message is not part of any field. It is part of the event and can be present in any part of the event. &lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2015 11:32:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-extraction-based-onmore-than-one-static-strings-and-find/m-p/233703#M188445</guid>
      <dc:creator>jyothishtj</dc:creator>
      <dc:date>2015-09-23T11:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: field extraction based onmore than one static strings and find out count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-extraction-based-onmore-than-one-static-strings-and-find/m-p/233704#M188446</link>
      <description>&lt;P&gt;Does your event contains the same data . Also if possible can you paste your sample data here . Try to extract the required fields which will help here.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2015 11:44:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-extraction-based-onmore-than-one-static-strings-and-find/m-p/233704#M188446</guid>
      <dc:creator>badrinath_itrs</dc:creator>
      <dc:date>2015-09-23T11:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: field extraction based onmore than one static strings and find out count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-extraction-based-onmore-than-one-static-strings-and-find/m-p/233705#M188447</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex max_match=0 "(?&amp;lt;message&amp;gt;(?:first message string)|(?:second message string)|(?:third message string)|(?:fourth message string)|(?:fifth message string)|(?:sixth message string)|(?:seventh message string))" | stats count by message
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Tack on &lt;CODE&gt;| fields - count&lt;/CODE&gt; to get  just the list of messages.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2015 14:54:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-extraction-based-onmore-than-one-static-strings-and-find/m-p/233705#M188447</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-23T14:54:24Z</dc:date>
    </item>
  </channel>
</rss>

