<?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: Search set of strings from lookup and list count of occurance in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87236#M22319</link>
    <description>&lt;P&gt;@sideview&lt;BR /&gt;
All simple strings without any space OR NOT&lt;/P&gt;</description>
    <pubDate>Wed, 17 Oct 2012 07:53:28 GMT</pubDate>
    <dc:creator>ma_anand1984</dc:creator>
    <dc:date>2012-10-17T07:53:28Z</dc:date>
    <item>
      <title>Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87227#M22310</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;How can i search several string got as input from look-up and display a table with number of occurrence of each string&lt;/P&gt;

&lt;P&gt;I'm trying to find this out for quite some time&lt;BR /&gt;
Thank you,&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2012 12:18:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87227#M22310</guid>
      <dc:creator>ma_anand1984</dc:creator>
      <dc:date>2012-10-11T12:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87228#M22311</link>
      <description>&lt;P&gt;How is this different from &lt;A href="http://splunk-base.splunk.com/answers/61146/search-mutiple-strings-in-logs-and-give-count-of-respective-string"&gt;http://splunk-base.splunk.com/answers/61146/search-mutiple-strings-in-logs-and-give-count-of-respective-string&lt;/A&gt; ?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2012 12:27:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87228#M22311</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-10-11T12:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87229#M22312</link>
      <description>&lt;P&gt;I didnt get the answer i need. Thought my question was not clear enough. I closed the other question&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2012 13:23:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87229#M22312</guid>
      <dc:creator>ma_anand1984</dc:creator>
      <dc:date>2012-10-11T13:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87230#M22313</link>
      <description>&lt;P&gt;Does &lt;BR /&gt;
    |inputlookup my_lookup | stats count by field&lt;BR /&gt;
do what you need?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Oct 2012 12:45:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87230#M22313</guid>
      <dc:creator>dart</dc:creator>
      <dc:date>2012-10-12T12:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87231#M22314</link>
      <description>&lt;P&gt;No, it doesn't. There are several issues that we are dealing with:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;First, the problem is that the search strings are not a field. &lt;/LI&gt;
&lt;LI&gt;It would be great if we could make the search strings display as a field or set of fields, but again, a few issues that we need to resolve first. 
a. The logs are free form and there is no standard format in order to find the specified text.
b. It is possible to have more than one matching string in an event.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Fri, 12 Oct 2012 14:42:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87231#M22314</guid>
      <dc:creator>SarahWKarvenz</dc:creator>
      <dc:date>2012-10-12T14:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87232#M22315</link>
      <description>&lt;OL&gt;
&lt;LI&gt;The other issue is one of performance. It may be possible to have over 100 strings that we are searching for and wanting to count....but also that this query has to be run every 2 minutes on a large set of data - looping through the results set for each string is not possible.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;I am wondering how the splunk highlighting works - essentially we would like to make those highlighted words into a single multivalued field which we could then count.&lt;/P&gt;

&lt;P&gt;We would like the final output to look like:&lt;BR /&gt;
search_string  count_of_times_in_last_two_minutes&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:37:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87232#M22315</guid>
      <dc:creator>SarahWKarvenz</dc:creator>
      <dc:date>2020-09-28T12:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87233#M22316</link>
      <description>&lt;P&gt;Could you define the things you are searching for as eventtypes? Then count by eventtype&lt;/P&gt;</description>
      <pubDate>Fri, 12 Oct 2012 15:24:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87233#M22316</guid>
      <dc:creator>dart</dc:creator>
      <dc:date>2012-10-12T15:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87234#M22317</link>
      <description>&lt;P&gt;eventtype won't work unfortunately. Due to permissions on the splunk instance and server etc, we need to be able to pull the list (which will be changed by non-splunk admin users) in from a csv file.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2012 16:03:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87234#M22317</guid>
      <dc:creator>SarahBOA</dc:creator>
      <dc:date>2012-10-15T16:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87235#M22318</link>
      <description>&lt;P&gt;Are the strings just simple strings with no spaces,   or are some of them multiple search terms (ie each one has spaces in it), or are they complex search expressions with parentheses, OR's and NOT's in them.    And as a followup, if they &lt;EM&gt;do&lt;/EM&gt; contain spaces, but not complex logic (parens, OR's, NOT's),   then do you want the terms searched for as a single string,  ie "foo bar baz", where it matches only if the exact string "foo bar baz" is in the raw event?   or do you want it to match any event that has "foo", "bar" and "baz" as indexed terms anywhere in the event.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2012 07:11:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87235#M22318</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2012-10-17T07:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87236#M22319</link>
      <description>&lt;P&gt;@sideview&lt;BR /&gt;
All simple strings without any space OR NOT&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2012 07:53:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87236#M22319</guid>
      <dc:creator>ma_anand1984</dc:creator>
      <dc:date>2012-10-17T07:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87237#M22320</link>
      <description>&lt;P&gt;Restating the goal ( to check that I understood it right)&lt;/P&gt;

&lt;P&gt;given a big set of simple terms like "fred" and "mildred"&lt;BR /&gt;
-- search a bunch of indexed events for all of these terms at once&lt;BR /&gt;
-- match events that contain one or more of the terms&lt;BR /&gt;
-- end up with a table showing the number of occurrences of each term in those events (assuming some events match more than one term) &lt;/P&gt;

&lt;P&gt;Here's my nutty idea.  First, in english: &lt;/P&gt;

&lt;P&gt;a) use inputlookup in a subsearch to generate the searchterms&lt;BR /&gt;
b) use a second inputlookup command in a second subsearch to actually glue ALL of the terms from the entire lookup onto each row of matched events, as a field called foo,  with each set of terms separated from the others by some safe character.. &lt;BR /&gt;
c) back in the outer search, use the eval command to split the giant superset of all foo values, by our safe character, generating a multivalue field called foo. &lt;BR /&gt;
c) then use mvexpand foo and now we instead of N lookup rows and M events, we have N*M events.  (It becomes important that your number of terms doesn't get terribly large. 100 should be fine)&lt;BR /&gt;
d) use a where clause to filter it down to just the rows where the _raw value contains the foo value. (We'll have to lowercase both sides because the like() function is case-sensitive)&lt;BR /&gt;
e) stats count by foo. &lt;/P&gt;

&lt;P&gt;Here it is again, in the search language.  Note you'll have to change the name of your lookup and the name of the field in your lookup. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[| inputlookup your_lookup_here | rename yourStringFieldName as search | fields search | format] 
| rename _raw as rawText
eval foo=[| inputlookup your_lookup_here | stats values(yourStringFieldName) as query | eval query=mvjoin(query,",") | fields query | format "" "" "" "" "" ""] 
| eval foo=split(foo,",") 
| mvexpand foo 
| eval foo=lower(foo)     
| eval rawText=lower(rawText) 
| where like(rawText,"%"+foo+"%")
| stats count by foo
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Oct 2012 08:23:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87237#M22320</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2012-10-17T08:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87238#M22321</link>
      <description>&lt;P&gt;For those who look at this question&lt;/P&gt;

&lt;P&gt;I get error in EVAL command. But it works fine in Nick's system. He tried a great deal in helping me, but could not succeed. If i succeed, I will drop a note. If others got some error with the above command and fixed it, please post the same here for the benefit of the community&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2012 05:32:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87238#M22321</guid>
      <dc:creator>ma_anand1984</dc:creator>
      <dc:date>2012-10-18T05:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87239#M22322</link>
      <description>&lt;P&gt;please check this post, the issue i had is fixed in the post &lt;A href="http://splunk-base.splunk.com/answers/31842/why-cant-i-use-subsearch-in-the-case-function-in-the-eval-command" target="_blank"&gt;http://splunk-base.splunk.com/answers/31842/why-cant-i-use-subsearch-in-the-case-function-in-the-eval-command&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Eval part should be like below&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
&lt;CODE&gt;&lt;BR /&gt;
eval foo=[| inputlookup your_lookup_here | stats values(yourStringFieldName) as query | eval query=mvjoin(query,",") | fields query | eval query = "\"".query."\""]&lt;BR /&gt;
&lt;/CODE&gt;&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:38:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87239#M22322</guid>
      <dc:creator>ma_anand1984</dc:creator>
      <dc:date>2020-09-28T12:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87240#M22323</link>
      <description>&lt;P&gt;Full query looks like&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
&lt;CODE&gt;&lt;BR /&gt;
[| inputlookup your_lookup_here | rename yourStringFieldName as search | fields search | format] &lt;BR /&gt;
| rename _raw as rawText&lt;BR /&gt;
eval foo=[| inputlookup your_lookup_here | stats values(yourStringFieldName) as query | eval query=mvjoin(query,",") | fields query  eval query = "\"".query."\""] &lt;BR /&gt;
| eval foo=split(foo,",") &lt;BR /&gt;
| mvexpand foo &lt;BR /&gt;
| eval foo=lower(foo)&lt;BR /&gt;&lt;BR /&gt;
| eval rawText=lower(rawText) &lt;BR /&gt;
| where like(rawText,"%"+foo+"%")&lt;BR /&gt;
| stats count by foo&lt;BR /&gt;
&lt;/CODE&gt;&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:38:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87240#M22323</guid>
      <dc:creator>ma_anand1984</dc:creator>
      <dc:date>2020-09-28T12:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Search set of strings from lookup and list count of occurance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87241#M22324</link>
      <description>&lt;P&gt;********&lt;STRONG&gt;&lt;EM&gt;check&lt;/EM&gt;&lt;/STRONG&gt;********&lt;BR /&gt;
&lt;A href="http://splunk-base.splunk.com/answers/62632/how-to-set-up-alert-on-splunk-that-notifies-on-occurrence-of-set-of-strings-above-threshold-value"&gt;http://splunk-base.splunk.com/answers/62632/how-to-set-up-alert-on-splunk-that-notifies-on-occurrence-of-set-of-strings-above-threshold-value&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;for more ideas&lt;/P&gt;</description>
      <pubDate>Fri, 19 Oct 2012 10:08:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-set-of-strings-from-lookup-and-list-count-of-occurance/m-p/87241#M22324</guid>
      <dc:creator>ma_anand1984</dc:creator>
      <dc:date>2012-10-19T10:08:25Z</dc:date>
    </item>
  </channel>
</rss>

