<?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: Is there a splunk equivalent for 'grep -f' ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-splunk-equivalent-for-grep-f/m-p/38649#M8806</link>
    <description>&lt;P&gt;I want to something similar to 'inputlookup', but with regular expressions.&lt;/P&gt;

&lt;P&gt;To be more specific, I have a file with error message templates used by application, and I search for corresponding actual errors in application log files. Regex examples:&lt;BR /&gt;
  File not found: .*&lt;BR /&gt;
  Invalid value '.&lt;EM&gt;' is provided for parameter '.&lt;/EM&gt;'.&lt;/P&gt;

&lt;P&gt;Thanks for 'inputlookup' explanation anyway.&lt;/P&gt;</description>
    <pubDate>Mon, 19 Aug 2013 16:52:39 GMT</pubDate>
    <dc:creator>alcm_b</dc:creator>
    <dc:date>2013-08-19T16:52:39Z</dc:date>
    <item>
      <title>Is there a splunk equivalent for 'grep -f' ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-splunk-equivalent-for-grep-f/m-p/38647#M8804</link>
      <description>&lt;P&gt;In *NIX, there is a command&lt;/P&gt;

&lt;P&gt;grep -f 'long_list_of_regex' 'my_log_file'&lt;/P&gt;

&lt;P&gt;, which reads a list of search commands from file. I wonder if there is an equivalent for that in Splunk. Basically - is there a way to perform a search for each of (quite long) list of regex, without making a long search query out of them? &lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2013 13:55:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-splunk-equivalent-for-grep-f/m-p/38647#M8804</guid>
      <dc:creator>alcm_b</dc:creator>
      <dc:date>2013-08-19T13:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a splunk equivalent for 'grep -f' ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-splunk-equivalent-for-grep-f/m-p/38648#M8805</link>
      <description>&lt;P&gt;Does it have to be regular expressions or would regular search expressions that can be understood by the search command suffice? If so, you could use subsearches for this. Setup your file with search expressions as a lookup in Splunk, and then read that file into a subsearch. Let's say your lookup is called &lt;CODE&gt;searchstrings.csv&lt;/CODE&gt; and looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;query
expression1
expression2
expression3
...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then if you issue a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* [|inputlookup searchstrings.csv | fields query]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The subsearch will expand into a filter string so the search will look something like this in the end:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* (("expression1") OR ("expression2") OR ("expression3") OR ... )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I imagine this is something similar to what you want to do.&lt;/P&gt;

&lt;P&gt;Note that the field "query" that I used in the example lookup is a special field name that makes Splunk output a "raw" filter string in the search. If you call it something else, say, "blah", the subsearch will instead expand to &lt;CODE&gt;((blah="expression1") OR ... )&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2013 15:31:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-splunk-equivalent-for-grep-f/m-p/38648#M8805</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-08-19T15:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a splunk equivalent for 'grep -f' ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-splunk-equivalent-for-grep-f/m-p/38649#M8806</link>
      <description>&lt;P&gt;I want to something similar to 'inputlookup', but with regular expressions.&lt;/P&gt;

&lt;P&gt;To be more specific, I have a file with error message templates used by application, and I search for corresponding actual errors in application log files. Regex examples:&lt;BR /&gt;
  File not found: .*&lt;BR /&gt;
  Invalid value '.&lt;EM&gt;' is provided for parameter '.&lt;/EM&gt;'.&lt;/P&gt;

&lt;P&gt;Thanks for 'inputlookup' explanation anyway.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2013 16:52:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-splunk-equivalent-for-grep-f/m-p/38649#M8806</guid>
      <dc:creator>alcm_b</dc:creator>
      <dc:date>2013-08-19T16:52:39Z</dc:date>
    </item>
  </channel>
</rss>

