<?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: Input a file into a query, possible? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Input-a-file-into-a-query-possible/m-p/99840#M25765</link>
    <description>&lt;P&gt;Yes, spaces, parenthesis... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
    <pubDate>Thu, 22 Mar 2012 23:00:58 GMT</pubDate>
    <dc:creator>gfoligna0</dc:creator>
    <dc:date>2012-03-22T23:00:58Z</dc:date>
    <item>
      <title>Input a file into a query, possible?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Input-a-file-into-a-query-possible/m-p/99837#M25762</link>
      <description>&lt;P&gt;We're working with really long queries (with a lot of excludes) and we're looking for a solution to short the query and to edit a single file every time we need to add another exclude.&lt;/P&gt;

&lt;P&gt;Is it clear to get the point?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;sourcetype=syslog "pattern1" NOT ("blah1" OR "blah2" OR "blah3" OR "blah4" OR "blah5") | stats count by host&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Goal:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;sourcetype=syslog "pattern1" NOT ( [file somewhere into the splunk searchead] ) | stats count by host&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2012 21:09:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Input-a-file-into-a-query-possible/m-p/99837#M25762</guid>
      <dc:creator>gfoligna0</dc:creator>
      <dc:date>2012-03-22T21:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Input a file into a query, possible?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Input-a-file-into-a-query-possible/m-p/99838#M25763</link>
      <description>&lt;P&gt;Sure. You could create a lookup file somewhere, say for instance &lt;CODE&gt;$SPLUNK_HOME/etc/system/lookups/excludefilters.csv&lt;/CODE&gt;, and refer to this in a subsearch pretty much like what you're suggesting yourself. The lookup file would have a header first of all defining what field Splunk should read each line's contents into, after that you put one query per line. So for instance with an &lt;CODE&gt;excludefilters.csv&lt;/CODE&gt; that looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;query
blah1
blah2
...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You could have a query that uses this in the following way:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="syslog" "pattern1" NOT [| inputlookup excludefilters.csv | fields query] | stats count by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that the field name "query" is a special field name that makes the subsearch output just the field value instead of fieldname=fieldvalue. So, make sure to use "query" as a field name to have this work for free-text filtering.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2012 21:44:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Input-a-file-into-a-query-possible/m-p/99838#M25763</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-03-22T21:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Input a file into a query, possible?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Input-a-file-into-a-query-possible/m-p/99839#M25764</link>
      <description>&lt;P&gt;The solution is perfect.&lt;BR /&gt;
Should I escape the spaces to look for the complete line instead of every word? Because I found that when I put spaces it starts to search and match for a single word.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2012 22:58:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Input-a-file-into-a-query-possible/m-p/99839#M25764</guid>
      <dc:creator>gfoligna0</dc:creator>
      <dc:date>2012-03-22T22:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Input a file into a query, possible?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Input-a-file-into-a-query-possible/m-p/99840#M25765</link>
      <description>&lt;P&gt;Yes, spaces, parenthesis... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2012 23:00:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Input-a-file-into-a-query-possible/m-p/99840#M25765</guid>
      <dc:creator>gfoligna0</dc:creator>
      <dc:date>2012-03-22T23:00:58Z</dc:date>
    </item>
  </channel>
</rss>

