<?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: Reference values in CSV versus hardcoding search query for desired results in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Reference-values-in-CSV-versus-hardcoding-search-query-for/m-p/416411#M73565</link>
    <description>&lt;P&gt;Dear @orion44,&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Write now your writing query as mentioned below.&lt;/STRONG&gt;&lt;BR /&gt;
Example report:&lt;BR /&gt;
index=datalog AND Name=Tim AND Name=Bob AND Name=Jenn AND Name=Stacy | table Name _time&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Your wishing to write the query as mentioned below. you don't want to hard-coding the Name value in query. You need to store it in a CSV file  and use it in all the query. am i right.&lt;/STRONG&gt;&lt;BR /&gt;
Desired result:&lt;BR /&gt;
names.csv (Name each line)&lt;BR /&gt;
index=datalog AND Name IN names.csv | table Name _time&lt;/P&gt;

&lt;P&gt;Steps:&lt;BR /&gt;
1. create a csv file and enter all the names in it.&lt;BR /&gt;
2. upload the names.csv file as lookup table. Follow the steps in below link. Filed name in both names.csv and index=datalog should be same.&lt;BR /&gt;
[&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/latest/Knowledge/Usefieldlookupstoaddinformationtoyourevents"&gt;https://docs.splunk.com/Documentation/SplunkCloud/latest/Knowledge/Usefieldlookupstoaddinformationtoyourevents&lt;/A&gt;]&lt;BR /&gt;
3. Use the lookup file and create a query as mentioned below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=datalog 
| lookup names.csv Name OUTPUTNEW   Name
| table Name _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Give a try and let me know whether its works or not.. &lt;/P&gt;

&lt;P&gt;Thanks .. &lt;/P&gt;</description>
    <pubDate>Mon, 10 Jun 2019 08:52:28 GMT</pubDate>
    <dc:creator>Shan</dc:creator>
    <dc:date>2019-06-10T08:52:28Z</dc:date>
    <item>
      <title>Reference values in CSV versus hardcoding search query for desired results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Reference-values-in-CSV-versus-hardcoding-search-query-for/m-p/416407#M73561</link>
      <description>&lt;P&gt;It is possible to have Splunk reference values inside a CSV file at search time? This is much needed as I'm currently hardcoding static values into multiple reports' search queries.&lt;/P&gt;

&lt;P&gt;Example report:&lt;BR /&gt;
index=datalog AND Name=Tim AND Name=Bob AND Name=Jenn AND Name=Stacy | table Name _time&lt;/P&gt;

&lt;P&gt;How can I put the names into a CSV (on the indexer) to be referenced at search time for multiple reports?&lt;/P&gt;

&lt;P&gt;Desired result:&lt;BR /&gt;
names.csv (Name each line)&lt;BR /&gt;
index=datalog AND Name IN names.csv | table Name _time&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 02:41:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Reference-values-in-CSV-versus-hardcoding-search-query-for/m-p/416407#M73561</guid>
      <dc:creator>orion44</dc:creator>
      <dc:date>2019-06-10T02:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Reference values in CSV versus hardcoding search query for desired results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Reference-values-in-CSV-versus-hardcoding-search-query-for/m-p/416408#M73562</link>
      <description>&lt;P&gt;Try using 'join' to pull in the values from the csv. Assuming the data has a field called 'name' as well as the csv the search would look like this:&lt;BR /&gt;
    index=datalog | join name [inputlookup names.csv] | table name _time&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 03:52:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Reference-values-in-CSV-versus-hardcoding-search-query-for/m-p/416408#M73562</guid>
      <dc:creator>mydog8it</dc:creator>
      <dc:date>2019-06-10T03:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Reference values in CSV versus hardcoding search query for desired results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Reference-values-in-CSV-versus-hardcoding-search-query-for/m-p/416409#M73563</link>
      <description>&lt;P&gt;I think I might have misunderstood your question.... My suggestion above would pull names from a csv and look for them in the data. If you are wanting to create a csv that contains the name and _time  from the data try something like this (you will need to decide on append):&lt;BR /&gt;
    index=datalog | table name _time | outputlookup append=[true or false] names.csv&lt;/P&gt;

&lt;P&gt;Then you can use join as shown above for report generation.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 04:02:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Reference-values-in-CSV-versus-hardcoding-search-query-for/m-p/416409#M73563</guid>
      <dc:creator>mydog8it</dc:creator>
      <dc:date>2019-06-10T04:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Reference values in CSV versus hardcoding search query for desired results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Reference-values-in-CSV-versus-hardcoding-search-query-for/m-p/416410#M73564</link>
      <description>&lt;P&gt;Thanks, I'm wanting to match strings inside a csv (on the indexer) when I perform a query for specific names (as part of a eval statement) at search time. Currently I'm hardcoding the names into the search query – however this method doesn't scale and requires updating multiple reports when names are added to the required search criteria.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 04:09:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Reference-values-in-CSV-versus-hardcoding-search-query-for/m-p/416410#M73564</guid>
      <dc:creator>orion44</dc:creator>
      <dc:date>2019-06-10T04:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: Reference values in CSV versus hardcoding search query for desired results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Reference-values-in-CSV-versus-hardcoding-search-query-for/m-p/416411#M73565</link>
      <description>&lt;P&gt;Dear @orion44,&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Write now your writing query as mentioned below.&lt;/STRONG&gt;&lt;BR /&gt;
Example report:&lt;BR /&gt;
index=datalog AND Name=Tim AND Name=Bob AND Name=Jenn AND Name=Stacy | table Name _time&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Your wishing to write the query as mentioned below. you don't want to hard-coding the Name value in query. You need to store it in a CSV file  and use it in all the query. am i right.&lt;/STRONG&gt;&lt;BR /&gt;
Desired result:&lt;BR /&gt;
names.csv (Name each line)&lt;BR /&gt;
index=datalog AND Name IN names.csv | table Name _time&lt;/P&gt;

&lt;P&gt;Steps:&lt;BR /&gt;
1. create a csv file and enter all the names in it.&lt;BR /&gt;
2. upload the names.csv file as lookup table. Follow the steps in below link. Filed name in both names.csv and index=datalog should be same.&lt;BR /&gt;
[&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/latest/Knowledge/Usefieldlookupstoaddinformationtoyourevents"&gt;https://docs.splunk.com/Documentation/SplunkCloud/latest/Knowledge/Usefieldlookupstoaddinformationtoyourevents&lt;/A&gt;]&lt;BR /&gt;
3. Use the lookup file and create a query as mentioned below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=datalog 
| lookup names.csv Name OUTPUTNEW   Name
| table Name _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Give a try and let me know whether its works or not.. &lt;/P&gt;

&lt;P&gt;Thanks .. &lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 08:52:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Reference-values-in-CSV-versus-hardcoding-search-query-for/m-p/416411#M73565</guid>
      <dc:creator>Shan</dc:creator>
      <dc:date>2019-06-10T08:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Reference values in CSV versus hardcoding search query for desired results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Reference-values-in-CSV-versus-hardcoding-search-query-for/m-p/416412#M73566</link>
      <description>&lt;P&gt;Thank you for the suggestion. Unfortunately a static lookup doesn't achieve what I want as the names in names.csv changes frequently. I just need to be able to reference variables (names) in a csv file instead of hardcoding them at search time.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 19:08:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Reference-values-in-CSV-versus-hardcoding-search-query-for/m-p/416412#M73566</guid>
      <dc:creator>orion44</dc:creator>
      <dc:date>2019-06-10T19:08:08Z</dc:date>
    </item>
  </channel>
</rss>

