<?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: How to search the count of keywords for each individual event, not for all events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-keywords-for-each-individual-event/m-p/251300#M75106</link>
    <description>&lt;P&gt;index=* | regex payload="SELECT | UPDATE | INSERT | CREATE| ALTER | RENAME | WHERE | DROP"&lt;BR /&gt;
| rex max_match=0 "(?SELECT | UPDATE | INSERT | CREATE |ALTER | RENAME | WHERE | DROP )" &lt;BR /&gt;
| eval amount=mvcount(keywords) &lt;BR /&gt;
| table payload, amount &lt;BR /&gt;
| rename amount as "No. of Keywords"&lt;/P&gt;</description>
    <pubDate>Thu, 26 Nov 2015 12:19:06 GMT</pubDate>
    <dc:creator>adaam94</dc:creator>
    <dc:date>2015-11-26T12:19:06Z</dc:date>
    <item>
      <title>How to search the count of keywords for each individual event, not for all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-keywords-for-each-individual-event/m-p/251299#M75105</link>
      <description>&lt;P&gt;How do I count the number of times keywords such as DROP, SELECT, FROM and WHERE appear for each event I have indexed? Looking at the HTTP header example I have, this is a single event. Is there an easy way to only count keywords from this as the searches I have used count all the keywords for all the events, but I only want a keyword count for each event. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"24455","POST","http://localhost:8080/tienda1/publico/pagar.jsp","HTTP/1.1","Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.8 (like Gecko)","no-cache","no-cache","text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5","x-gzip, x-deflate, gzip, deflate","utf-8, utf-8;q=0.5, *;q=0.5","en","localhost:8080","close","103","application/x-www-form-urlencoded","JSESSIONID=12546061FC0154DC98FEC5A70E87F6B4","B1='; DROP TABLE usuarios; SELECT * FROM datos WHERE nombre LIKE '%","anom"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So for this example the answer should be 4. any suggestions? &lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 23:04:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-keywords-for-each-individual-event/m-p/251299#M75105</guid>
      <dc:creator>adaam94</dc:creator>
      <dc:date>2015-11-25T23:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to search the count of keywords for each individual event, not for all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-keywords-for-each-individual-event/m-p/251300#M75106</link>
      <description>&lt;P&gt;index=* | regex payload="SELECT | UPDATE | INSERT | CREATE| ALTER | RENAME | WHERE | DROP"&lt;BR /&gt;
| rex max_match=0 "(?SELECT | UPDATE | INSERT | CREATE |ALTER | RENAME | WHERE | DROP )" &lt;BR /&gt;
| eval amount=mvcount(keywords) &lt;BR /&gt;
| table payload, amount &lt;BR /&gt;
| rename amount as "No. of Keywords"&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2015 12:19:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-keywords-for-each-individual-event/m-p/251300#M75106</guid>
      <dc:creator>adaam94</dc:creator>
      <dc:date>2015-11-26T12:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to search the count of keywords for each individual event, not for all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-keywords-for-each-individual-event/m-p/251301#M75107</link>
      <description>&lt;P&gt;adaam94, &lt;/P&gt;

&lt;P&gt;I converted your comment to an answer so hopefully it can be accepted!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2015 12:55:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-keywords-for-each-individual-event/m-p/251301#M75107</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2015-11-26T12:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to search the count of keywords for each individual event, not for all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-keywords-for-each-individual-event/m-p/251302#M75108</link>
      <description>&lt;P&gt;I ran it to test and made a few tweaks:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* | eval mystring="24455,POST,http://localhost:8080/tienda1/publico/pagar.jsp,HTTP/1.1,Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.8 (like Gecko),no-cache,no-cache,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,/;q=0.5,x-gzip, x-deflate, gzip, deflate,utf-8, utf-8;q=0.5, ;q=0.5,en,localhost:8080,close,103,application/x-www-form-urlencoded,JSESSIONID=12546061FC0154DC98FEC5A70E87F6B4,B1='; DROP TABLE usuarios; SELECT FROM datos WHERE nombre LIKE '%,anom"
| rex max_match=0 field=mystring "(?&amp;lt;keywords&amp;gt;SELECT|UPDATE|INSERT|CREATE|ALTER|RENAME|WHERE|DROP)"
| eval amount=mvcount(keywords)
| table mystring, keywords, amount
| rename amount as "No. of Keywords"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And that returns keywords of DROP, SELECT and WHERE and a count of 3.&lt;/P&gt;

&lt;P&gt;For your data, you won't likely need a lot of that:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=blah eventtype=bleh my base search here ... 
| rex max_match=0 field=mystring "(?&amp;lt;keywords&amp;gt;SELECT|UPDATE|INSERT|CREATE|ALTER|RENAME|WHERE|DROP)"
| eval number_of_keywords=mvcount(keywords)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Give that a try and report back here to adaam94 on how it worked!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2015 13:13:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-keywords-for-each-individual-event/m-p/251302#M75108</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2015-11-26T13:13:21Z</dc:date>
    </item>
  </channel>
</rss>

