<?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: where in stats command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525007#M148111</link>
    <description>&lt;P&gt;The problem with made up data is it can be difficult to give a useful answer.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is tags a single field?&lt;/LI&gt;&lt;LI&gt;Is class always followed by a colon and 3 numbers?&lt;/LI&gt;&lt;LI&gt;Is class always at the end if the tags string?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;However, given the example, try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype="my-data" 
| rex field=tags "(?&amp;lt;class&amp;gt;class:\d+)"
| stats count by class&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 16 Oct 2020 07:18:46 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2020-10-16T07:18:46Z</dc:date>
    <item>
      <title>where in stats command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/524996#M148109</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I have my fields like below,&lt;/P&gt;&lt;TABLE width="378px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="125px" height="25px"&gt;indicator&lt;/TD&gt;&lt;TD width="252px" height="25px"&gt;tags&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="125px" height="25px"&gt;indicator 1&lt;/TD&gt;&lt;TD width="252px" height="25px"&gt;tag 1,class:234&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="125px" height="25px"&gt;indicator 2&lt;/TD&gt;&lt;TD width="252px" height="25px"&gt;tagg,class:456&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I have to group my fields based on tags starting with class, and my query is like below,&lt;/P&gt;&lt;P&gt;sourcetype="my-data" |stats count by tags|where tags="class*"&lt;/P&gt;&lt;P&gt;But I am getting 0 results, as where class is taking only exact values and not "class*"&lt;/P&gt;&lt;P&gt;I want my result as below,&lt;/P&gt;&lt;P&gt;class:234 1&lt;/P&gt;&lt;P&gt;class:456 1&lt;/P&gt;&lt;P&gt;Kindly suggest.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 05:49:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/524996#M148109</guid>
      <dc:creator>Janani_Krish</dc:creator>
      <dc:date>2020-10-16T05:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: where in stats command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525005#M148110</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223190"&gt;@Janani_Krish&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if the structure of your tags is always "xxx,value" you could use a regex to extract the value after comma, something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype="my-data" 
| stats count by tags
| rex field=tags "^[^,]*,(?&amp;lt;tags&amp;gt;.*)"
| search tags="class*"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 07:14:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525005#M148110</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-10-16T07:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: where in stats command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525007#M148111</link>
      <description>&lt;P&gt;The problem with made up data is it can be difficult to give a useful answer.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is tags a single field?&lt;/LI&gt;&lt;LI&gt;Is class always followed by a colon and 3 numbers?&lt;/LI&gt;&lt;LI&gt;Is class always at the end if the tags string?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;However, given the example, try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype="my-data" 
| rex field=tags "(?&amp;lt;class&amp;gt;class:\d+)"
| stats count by class&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 16 Oct 2020 07:18:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525007#M148111</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-16T07:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: where in stats command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525010#M148112</link>
      <description>&lt;P&gt;Try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|where tags like "%class%"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 16 Oct 2020 07:25:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525010#M148112</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-10-16T07:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: where in stats command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525020#M148115</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/136781"&gt;@renjith_nair&lt;/a&gt;&amp;nbsp; this works. But If I am using this with timechart it is not working.&lt;/P&gt;&lt;P&gt;sourcetype="my-data" |timechart span=4h count by tags|where tags like "%class%"&lt;/P&gt;&lt;P&gt;Can you suggest.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 08:41:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525020#M148115</guid>
      <dc:creator>Janani_Krish</dc:creator>
      <dc:date>2020-10-16T08:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: where in stats command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525021#M148116</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thank you for the suggestion. But my structure varies,,it is not always followed by comma.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 08:43:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525021#M148116</guid>
      <dc:creator>Janani_Krish</dc:creator>
      <dc:date>2020-10-16T08:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: where in stats command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525022#M148117</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223190"&gt;@Janani_Krish&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You should try (if possible) to identify all the rules of your tags field and write all the possible regexes to extract the tags you want.&lt;/P&gt;&lt;P&gt;There'a also anothe choice, if the list of tags isn't lo long and it's manageable, you could put the tags in a lookup and use this lookup to match the events with a tag.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 08:52:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525022#M148117</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-10-16T08:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: where in stats command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525023#M148118</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for the reply,&lt;/P&gt;&lt;P&gt;1.No tags contain multiple fields or single field depending upon the log.&lt;/P&gt;&lt;P&gt;2.No class doesnt have any pattern.&lt;/P&gt;&lt;P&gt;3.No class can be anywhere in tags.&lt;/P&gt;&lt;P&gt;Rex command works well with timechart and stats command as well.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 08:52:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/where-in-stats-command/m-p/525023#M148118</guid>
      <dc:creator>Janani_Krish</dc:creator>
      <dc:date>2020-10-16T08:52:18Z</dc:date>
    </item>
  </channel>
</rss>

