<?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 How to get data from log and count event values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559525#M158951</link>
    <description>&lt;P&gt;Hello Team,&lt;/P&gt;&lt;P&gt;I'm very new to splunk, I have below two logs&lt;/P&gt;&lt;P&gt;"message": "api.main REQ user1 10.10.44.76 \"GET /api/v1/data?my_list=%25geo%25&amp;amp;our_list=%25school%25&amp;amp;query_string_list=%25college%25&amp;amp;page=1&amp;amp;per_page=100\"&lt;BR /&gt;"message": "api.main REQ user2 10.10.14.16 \"GET /api/v1/data?my_list=%25geo%25&amp;amp;our_list=%25office%25&amp;amp;query_string_list=%25school%25&amp;amp;page=1&amp;amp;per_page=100\"&lt;/P&gt;&lt;P&gt;I want to get data between&amp;nbsp; "%25school%25" -&amp;gt; school.&lt;/P&gt;&lt;P&gt;So contains log1: school, collage&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;log2: office, school&lt;/P&gt;&lt;P&gt;We can count and show: school=2, office=1,collage=1, If possible we can plot in time chart &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jul 2021 06:10:57 GMT</pubDate>
    <dc:creator>Rakesh915473</dc:creator>
    <dc:date>2021-07-15T06:10:57Z</dc:date>
    <item>
      <title>How to get data from log and count event values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559525#M158951</link>
      <description>&lt;P&gt;Hello Team,&lt;/P&gt;&lt;P&gt;I'm very new to splunk, I have below two logs&lt;/P&gt;&lt;P&gt;"message": "api.main REQ user1 10.10.44.76 \"GET /api/v1/data?my_list=%25geo%25&amp;amp;our_list=%25school%25&amp;amp;query_string_list=%25college%25&amp;amp;page=1&amp;amp;per_page=100\"&lt;BR /&gt;"message": "api.main REQ user2 10.10.14.16 \"GET /api/v1/data?my_list=%25geo%25&amp;amp;our_list=%25office%25&amp;amp;query_string_list=%25school%25&amp;amp;page=1&amp;amp;per_page=100\"&lt;/P&gt;&lt;P&gt;I want to get data between&amp;nbsp; "%25school%25" -&amp;gt; school.&lt;/P&gt;&lt;P&gt;So contains log1: school, collage&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;log2: office, school&lt;/P&gt;&lt;P&gt;We can count and show: school=2, office=1,collage=1, If possible we can plot in time chart &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 06:10:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559525#M158951</guid>
      <dc:creator>Rakesh915473</dc:creator>
      <dc:date>2021-07-15T06:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data from log and count event values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559527#M158952</link>
      <description>&lt;P&gt;give this a try.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=_raw "our_list=%25(?&amp;lt;new_field1&amp;gt;\w+)"
| rex field=_raw "string_list=%25(?&amp;lt;new_field2&amp;gt;\w+)"
| stats count by new_field1 new_field2

for timechart portion of you question:
| timechart span=1d count by new_field1 new_field2 usenull=f&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 06:38:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559527#M158952</guid>
      <dc:creator>splunkerer</dc:creator>
      <dc:date>2021-07-15T06:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data from log and count event values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559528#M158953</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236192"&gt;@Rakesh915473&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can try this also,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;YOUR_SEARCH
| rex field=_raw "our_list=%25(?&amp;lt;our_list&amp;gt;.*)%25&amp;amp;query_string_list=%25(?&amp;lt;query_string_list&amp;gt;.*)%25"
| table our_list query_string_list&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;KV&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 06:26:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559528#M158953</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-07-15T06:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data from log and count event values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559529#M158954</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236192"&gt;@Rakesh915473&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you try this,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "ur_list=%25(?&amp;lt;field1&amp;gt;\w+)%25&amp;amp;query_string_list=%25(?&amp;lt;field2&amp;gt;\w+)"&lt;/LI-CODE&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;An upvote would be appreciated if this reply helps!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 06:28:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559529#M158954</guid>
      <dc:creator>venkatasri</dc:creator>
      <dc:date>2021-07-15T06:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data from log and count event values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559539#M158958</link>
      <description>&lt;P&gt;Thankyou&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/234050"&gt;@splunkerer&lt;/a&gt;&amp;nbsp;, It's working &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Couple more questions please.&lt;/P&gt;&lt;P&gt;1) Could you please explain me in detail what this expression does, Please &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(?&amp;lt;new_field&amp;gt;\W+)&lt;/P&gt;&lt;P&gt;2) If I want to exclude particular values fetch from new_field1 and new_field2. Ex: school and collage&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 07:33:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559539#M158958</guid>
      <dc:creator>Rakesh915473</dc:creator>
      <dc:date>2021-07-15T07:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data from log and count event values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559651#M158989</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236192"&gt;@Rakesh915473&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am glad it worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&lt;SPAN&gt;(?&amp;lt;new_field&amp;gt;\&lt;STRONG&gt;&lt;FONT color="#000000"&gt;w&lt;/FONT&gt;&lt;/STRONG&gt;+)&amp;nbsp; &amp;nbsp; &amp;nbsp;---&amp;gt; It was not capital "W", but '&lt;STRONG&gt;w&lt;/STRONG&gt;' This is Splunk regex syntax. There are 2 important portion of this&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;a.&amp;nbsp;new_field : you can change this anything you want, at the end of the search you will see this name as a new field on the Splunk.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;b. \w+&amp;nbsp; : this is regular expression to match your need. Basically \w+ this matches one or more word character.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;All other characters&amp;nbsp;are just standard format which should be there if you are looking for specific field extraction.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;you can check these for more information&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;A href="https://regex101.com/" target="_blank"&gt;https://regex101.com/&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.1/SearchReference/Rex" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.1/SearchReference/Rex&lt;/A&gt;&lt;/P&gt;&lt;P&gt;2. for exclusion you can do it on rex, but also you do it after field extraction for simplicity since you can easily exclude anything you want after extracting data .&lt;/P&gt;&lt;P&gt;for example:&lt;/P&gt;&lt;P&gt;after field extraction with rex you can use:&lt;/P&gt;&lt;P&gt;| where new_field1!=school OR new_field2!=school ....etc&lt;/P&gt;&lt;P&gt;in the rex:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| rex field=_raw "our_list=%25(?&amp;lt;new_field&amp;gt;(!school|collage)\w+)"&lt;BR /&gt;| rex field=_raw "string_list=%25(?&amp;lt;new_field&amp;gt;(!school|collage)\w+)"&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 16:46:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559651#M158989</guid>
      <dc:creator>splunkerer</dc:creator>
      <dc:date>2021-07-15T16:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data from log and count event values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559743#M159024</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/234050"&gt;@splunkerer&lt;/a&gt;&amp;nbsp;Great explanation &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Very nice of you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 04:54:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559743#M159024</guid>
      <dc:creator>Rakesh915473</dc:creator>
      <dc:date>2021-07-16T04:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data from log and count event values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559745#M159026</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Why&amp;nbsp; &lt;STRONG&gt;rex field=_raw&lt;/STRONG&gt; ??&amp;nbsp; is it not supposed to be&lt;STRONG&gt; rex field=message&lt;/STRONG&gt; as per my logs.&lt;/P&gt;&lt;P&gt;Please confirm why you mentioned&lt;STRONG&gt; _raw&lt;/STRONG&gt; as field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 05:09:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559745#M159026</guid>
      <dc:creator>Rakesh915473</dc:creator>
      <dc:date>2021-07-16T05:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data from log and count event values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559750#M159029</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236192"&gt;@Rakesh915473&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your log extracting proper&amp;nbsp;&lt;STRONG&gt;message &lt;/STRONG&gt;field with proper then you can use it in rex else _raw will always be there.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 05:24:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559750#M159029</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-07-16T05:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data from log and count event values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559767#M159040</link>
      <description>&lt;P&gt;you are welcome&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236192"&gt;@Rakesh915473&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;if you dont mind, can you accept it as solution to close this thread.&lt;BR /&gt;&lt;BR /&gt;Best,&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 06:50:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559767#M159040</guid>
      <dc:creator>splunkerer</dc:creator>
      <dc:date>2021-07-16T06:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data from log and count event values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559991#M159124</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/234050"&gt;@splunkerer&lt;/a&gt;&amp;nbsp; Accepted.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| rex field=_raw "our_list=%25(?&amp;lt;new_field1&amp;gt;(!school|collage)\w+)"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| rex field=_raw "string_list=%25(?&amp;lt;new_field2&amp;gt;(!school|collage)\w+)"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, School and collage is not excluding, moreover no data is showing, If I add&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"| stats count by new_field new_field2"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;How can we make it work?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 07:32:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/559991#M159124</guid>
      <dc:creator>Rakesh915473</dc:creator>
      <dc:date>2021-07-19T07:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data from log and count event values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/560570#M159317</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/163730"&gt;@venkatasri&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can we skip one/two letter words, How can we do it from above search string?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 07:21:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/560570#M159317</guid>
      <dc:creator>Rakesh915473</dc:creator>
      <dc:date>2021-07-23T07:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data from log and count event values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/560594#M159327</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236192"&gt;@Rakesh915473&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This one works for word with min 3 chars,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex  "our_list=%25(?&amp;lt;field1&amp;gt;\w{3,})%25&amp;amp;query_string_list=%25(?&amp;lt;field2&amp;gt;\w{3,})"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;An upvote would be appreciated if this reply helps!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 10:48:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-from-log-and-count-event-values/m-p/560594#M159327</guid>
      <dc:creator>venkatasri</dc:creator>
      <dc:date>2021-07-23T10:48:58Z</dc:date>
    </item>
  </channel>
</rss>

