<?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: Ho to get search input from csv file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Ho-to-get-search-input-from-csv-file/m-p/321147#M95943</link>
    <description>&lt;P&gt;Thank you!!! It works&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jul 2017 03:35:10 GMT</pubDate>
    <dc:creator>Kwip</dc:creator>
    <dc:date>2017-07-05T03:35:10Z</dc:date>
    <item>
      <title>Ho to get search input from csv file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Ho-to-get-search-input-from-csv-file/m-p/321144#M95940</link>
      <description>&lt;P&gt;I am having a csv file which contains some production server jobs name to monitor. I want to give those jobs listed in the file as a search string input to the splunk.&lt;/P&gt;

&lt;P&gt;Is there any way to achieve it?&lt;/P&gt;

&lt;P&gt;I cant put the Jobs in search as JOB1 OR JOB2 OR JOB3 OR and so on. But the job list is more than 60, so i am looking for a way to give all those job names as search input directly. Please let me know which command i need to use for this purpose. &lt;/P&gt;

&lt;P&gt;Thanks in Advance.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 10:23:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Ho-to-get-search-input-from-csv-file/m-p/321144#M95940</guid>
      <dc:creator>Kwip</dc:creator>
      <dc:date>2017-04-07T10:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: Ho to get search input from csv file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Ho-to-get-search-input-from-csv-file/m-p/321145#M95941</link>
      <description>&lt;P&gt;Hi Kwip,&lt;BR /&gt;
You have to do the following steps:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;create a lookup (e.g. jobs.csv), I suggest to use Lookup Editor App, it's usefule to use as lookup column name the same name of the field in your logs (e.g. (job");&lt;/LI&gt;
&lt;LI&gt;create a lookup definition [Settings -- Lookups -- Lookup Definitions] related to the new lookup;&lt;/LI&gt;
&lt;LI&gt;use lookup to filter your searches.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;the search is something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your_search [ | inputlookup jobs.csv | fields job ]
| ....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to monitor the presence of logs for all lookup values, your search will be something like this:&lt;BR /&gt;
Your_search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count by job
| append [ | inputlookup jobs.csv | eval count=0| fields job count ]
| stats sum(count) AS Total by job
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this way:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Total=0 for one or more jobs means that there aren't logs for these jobs (you could also trigger an alert for this);&lt;/LI&gt;
&lt;LI&gt;Total&amp;gt;0 means that there are logs for that job.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 11:58:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Ho-to-get-search-input-from-csv-file/m-p/321145#M95941</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-04-07T11:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Ho to get search input from csv file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Ho-to-get-search-input-from-csv-file/m-p/321146#M95942</link>
      <description>&lt;P&gt;Generally I prefer to use &lt;CODE&gt;table&lt;/CODE&gt; rather than &lt;CODE&gt;fields&lt;/CODE&gt; here, because it ensures there will be no odd internal fields that I don't know about.  For inputlookup or inputcsv it might not happen, but we often use the same formula for all kinds of searches that make data, so a habit of using &lt;CODE&gt;table&lt;/CODE&gt; will pay off in the long run.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your_search [ | inputlookup jobs.csv | table job ]
 | ....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Kwip - the above command works because the subsearch in the braces [] is implicitly processed by the &lt;CODE&gt;format&lt;/CODE&gt; command into a string that looks like "( ( job=JOB1 ) OR ( job=JOB2 ) OR ( job=JOB3 ) OR... )", just as if &lt;CODE&gt;format&lt;/CODE&gt; was explicitly called like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your_search [ | inputlookup jobs.csv | table job | format ]
 | ....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For more details on how it works, see the &lt;CODE&gt;format&lt;/CODE&gt; command.  &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.2/SearchReference/Format"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.2/SearchReference/Format&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 15:57:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Ho-to-get-search-input-from-csv-file/m-p/321146#M95942</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-04-07T15:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Ho to get search input from csv file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Ho-to-get-search-input-from-csv-file/m-p/321147#M95943</link>
      <description>&lt;P&gt;Thank you!!! It works&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 03:35:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Ho-to-get-search-input-from-csv-file/m-p/321147#M95943</guid>
      <dc:creator>Kwip</dc:creator>
      <dc:date>2017-07-05T03:35:10Z</dc:date>
    </item>
  </channel>
</rss>

