<?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: NOOB - run a query in batch with varying input in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/NOOB-run-a-query-in-batch-with-varying-input/m-p/35363#M6426</link>
    <description>&lt;P&gt;This can certainly be done. The learning curve of implementing it might become a bit steep if you're totally new to Splunk though. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;You should be able to achieve what you want using a combination of&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;A subsearch (&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/User/HowSubsearchesWork"&gt;http://docs.splunk.com/Documentation/Splunk/latest/User/HowSubsearchesWork&lt;/A&gt;)&lt;/LI&gt;
&lt;LI&gt;A lookup (&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/User/CreateAndConfigureFieldLookups"&gt;http://docs.splunk.com/Documentation/Splunk/latest/User/CreateAndConfigureFieldLookups&lt;/A&gt;)&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;A subsearch works a lot like backticks in UNIX if you're familiar with them. It runs first of all and passes on its results as arguments to the main search. A lookup can be either static, a CSV file that Splunk reads from, or dynamic, in which case Splunk calls a script and uses its results.&lt;/P&gt;

&lt;P&gt;The idea in your case would be to have a lookup CSV file containing all the numbers you want to monitor, and then pass those numbers to the main search which checks if the numbers are there or not. Then, create an alert (&lt;A href="http://docs.splunk.com/Documentation/Splunk/4.2.4/User/SchedulingSavedSearches"&gt;http://docs.splunk.com/Documentation/Splunk/4.2.4/User/SchedulingSavedSearches&lt;/A&gt;) that triggers if you're getting results back.&lt;/P&gt;

&lt;P&gt;My best advice from here would be to go read up on the mechanisms involved before diving into this. Your final search command might look something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="yoursourcetypewiththenumbers" [| inputlookup numbers.csv | fields number]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here, I set the sourcetype to just a dummy sourcetype - I don't know how you filter on the exact logs that you want to check these numbers for. I also assumed that the numbers exist in a field called "numbers" in both the CSV file and in the logs - change this to whatever fieldname you're using. Hope this helps with getting you started.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Dec 2011 06:53:34 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2011-12-15T06:53:34Z</dc:date>
    <item>
      <title>NOOB - run a query in batch with varying input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/NOOB-run-a-query-in-batch-with-varying-input/m-p/35360#M6423</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
A total Splunk NOOB, so please go easy.&lt;/P&gt;

&lt;P&gt;Anyway, every night I receive a bunch of numbers and I want Splunk to dig through my logs and tell me if these numbers are not there, or if they are tell me the info associated with these numbers.&lt;BR /&gt;
How do I go about achieving that?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2011 00:08:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/NOOB-run-a-query-in-batch-with-varying-input/m-p/35360#M6423</guid>
      <dc:creator>ranshe</dc:creator>
      <dc:date>2011-12-15T00:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: NOOB - run a query in batch with varying input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/NOOB-run-a-query-in-batch-with-varying-input/m-p/35361#M6424</link>
      <description>&lt;P&gt;It would be helpful if you could give us some examples of your data (fake the ip addresses, etc. if needed).&lt;/P&gt;

&lt;P&gt;You need to run a search, and then save it and schedule it to run every night.  Schedule it to run at a time &lt;EM&gt;after&lt;/EM&gt; you receive the numbers.  Also, set it up to alert you via email "always" and it will send you a report every night that shows if anything matched.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2011 00:17:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/NOOB-run-a-query-in-batch-with-varying-input/m-p/35361#M6424</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2011-12-15T00:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: NOOB - run a query in batch with varying input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/NOOB-run-a-query-in-batch-with-varying-input/m-p/35362#M6425</link>
      <description>&lt;P&gt;Thanks lguinn.&lt;BR /&gt;
My question is really about the "You need to run a search, and then save it and schedule it to run every night" part - how do I do that?&lt;BR /&gt;
Also, is there a way for me to dump a file with my numbers and have Splunk read it and act on it?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2011 05:31:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/NOOB-run-a-query-in-batch-with-varying-input/m-p/35362#M6425</guid>
      <dc:creator>ranshe</dc:creator>
      <dc:date>2011-12-15T05:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: NOOB - run a query in batch with varying input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/NOOB-run-a-query-in-batch-with-varying-input/m-p/35363#M6426</link>
      <description>&lt;P&gt;This can certainly be done. The learning curve of implementing it might become a bit steep if you're totally new to Splunk though. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;You should be able to achieve what you want using a combination of&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;A subsearch (&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/User/HowSubsearchesWork"&gt;http://docs.splunk.com/Documentation/Splunk/latest/User/HowSubsearchesWork&lt;/A&gt;)&lt;/LI&gt;
&lt;LI&gt;A lookup (&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/User/CreateAndConfigureFieldLookups"&gt;http://docs.splunk.com/Documentation/Splunk/latest/User/CreateAndConfigureFieldLookups&lt;/A&gt;)&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;A subsearch works a lot like backticks in UNIX if you're familiar with them. It runs first of all and passes on its results as arguments to the main search. A lookup can be either static, a CSV file that Splunk reads from, or dynamic, in which case Splunk calls a script and uses its results.&lt;/P&gt;

&lt;P&gt;The idea in your case would be to have a lookup CSV file containing all the numbers you want to monitor, and then pass those numbers to the main search which checks if the numbers are there or not. Then, create an alert (&lt;A href="http://docs.splunk.com/Documentation/Splunk/4.2.4/User/SchedulingSavedSearches"&gt;http://docs.splunk.com/Documentation/Splunk/4.2.4/User/SchedulingSavedSearches&lt;/A&gt;) that triggers if you're getting results back.&lt;/P&gt;

&lt;P&gt;My best advice from here would be to go read up on the mechanisms involved before diving into this. Your final search command might look something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="yoursourcetypewiththenumbers" [| inputlookup numbers.csv | fields number]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here, I set the sourcetype to just a dummy sourcetype - I don't know how you filter on the exact logs that you want to check these numbers for. I also assumed that the numbers exist in a field called "numbers" in both the CSV file and in the logs - change this to whatever fieldname you're using. Hope this helps with getting you started.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2011 06:53:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/NOOB-run-a-query-in-batch-with-varying-input/m-p/35363#M6426</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2011-12-15T06:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: NOOB - run a query in batch with varying input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/NOOB-run-a-query-in-batch-with-varying-input/m-p/35364#M6427</link>
      <description>&lt;P&gt;Wow, lots of great info - highly appreciated!&lt;BR /&gt;
Now the "homework" is on me - I'll play around and see how to use all this info.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2011 19:27:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/NOOB-run-a-query-in-batch-with-varying-input/m-p/35364#M6427</guid>
      <dc:creator>ranshe</dc:creator>
      <dc:date>2011-12-15T19:27:05Z</dc:date>
    </item>
  </channel>
</rss>

