<?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: How to Combine search query with a lookup file with one common field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-Combine-search-query-with-a-lookup-file-with-one-common/m-p/296889#M165077</link>
    <description>&lt;P&gt;Hi @varunghai,&lt;/P&gt;

&lt;P&gt;Glad to help you.&lt;/P&gt;

&lt;P&gt;Can you please accept the answer to close this question and upvote answer?&lt;/P&gt;

&lt;P&gt;Happy Splunking&lt;/P&gt;</description>
    <pubDate>Fri, 17 Nov 2017 16:40:11 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2017-11-17T16:40:11Z</dc:date>
    <item>
      <title>How to Combine search query with a lookup file with one common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Combine-search-query-with-a-lookup-file-with-one-common/m-p/296885#M165073</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;i want to combine the results from my search query with a lookup table that i have uploaded. They both have 1 column in common &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Search Query&lt;/STRONG&gt;:&lt;BR /&gt;
index=tomcat source ="/files0/nlhyp*" [Job] cronjob earliest=@d Action=Starting &lt;BR /&gt;
| table CronJobName _time&lt;BR /&gt;&lt;BR /&gt;
| rename _time as time1&lt;BR /&gt;&lt;BR /&gt;
| eval StartTime=strftime(time1,"%m/%d/%y %H:%M:%S") &lt;BR /&gt;
| Join&lt;BR /&gt;&lt;BR /&gt;
    [&lt;BR /&gt;&lt;BR /&gt;
        search index=tomcat source ="/files0/nlhyp*" [Job] cronjob earliest=@d Action=Finished  | table CronJobName _time  | rename _time as time2  | eval EndTime=strftime(time2,"%m/%d/%y %H:%M:%S")&lt;BR /&gt;&lt;BR /&gt;
    ] &lt;BR /&gt;
| table CronJobName StartTime EndTime|dedup CronJobName&lt;/P&gt;

&lt;P&gt;Sample output:&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/219805-qop.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Lookup file&lt;/STRONG&gt;:&lt;BR /&gt;
CronJobLookup.csv&lt;/P&gt;

&lt;P&gt;Sample output:&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/219806-lop.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;i have tried both of them individually and they work perfectly fine, so there is no issue with the current query.&lt;BR /&gt;
The column which is common in both is called "CronJobName"&lt;/P&gt;

&lt;P&gt;I want to join both these and create a table which has columns- CronJobName Expected_STart_Time Expected_End_Time StartTime EndTime Job_Frequency etc..&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:53:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Combine-search-query-with-a-lookup-file-with-one-common/m-p/296885#M165073</guid>
      <dc:creator>varunghai</dc:creator>
      <dc:date>2020-09-29T16:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine search query with a lookup file with one common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Combine-search-query-with-a-lookup-file-with-one-common/m-p/296886#M165074</link>
      <description>&lt;P&gt;Hi @varunghai,&lt;/P&gt;

&lt;P&gt;Can you please try this single query &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tomcat source ="/files0/nlhyp*" [Job] cronjob earliest=@d | transaction CronJobName startswith="Starting" endswith="Finished"
| dedup CronJobName
| eval EndTime_ep=_time + duration 
| eval StartTime=strftime(_time, "%d-%m-%Y %H:%M:%S"), EndTime=strftime(EndTime_ep, "%d-%m-%Y %H:%M:%S")
| fields CronJobName StartTime EndTime
| lookup CronJobLookup.csv CronJobName AS CronJobName OUTPUT CronJobName AS Lookup_CronJobName Expected_STart_Time Expected_End_Time StartTime EndTime Job_Frequency
| where isnotnull(Lookup_CronJobName)
| fields - Lookup_CronJobName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;EDIT: Updated from &lt;CODE&gt;table&lt;/CODE&gt; to &lt;CODE&gt;fields&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 10:39:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Combine-search-query-with-a-lookup-file-with-one-common/m-p/296886#M165074</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-11-17T10:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine search query with a lookup file with one common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Combine-search-query-with-a-lookup-file-with-one-common/m-p/296887#M165075</link>
      <description>&lt;P&gt;Hi @varunghai,&lt;/P&gt;

&lt;P&gt;Can you please try below search??&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR_FIRST_SEARCH
| append [ inputlookup CronJobLookup.csv | table CronJobName Expected_STart_Time Expected_End_Time StartTime EndTime Job_Frequency  ]
| stats values(CronJobName) as CronJobName values(Expected_STart_Time) as Expected_STart_Time values(Expected_End_Time) as Expected_End_Time values(StartTime) as StartTime values(EndTime) as EndTime values(Job_Frequency) as Job_Frequency by CronJobName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Change lookupfile column name as per your need.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 10:41:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Combine-search-query-with-a-lookup-file-with-one-common/m-p/296887#M165075</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-17T10:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine search query with a lookup file with one common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Combine-search-query-with-a-lookup-file-with-one-common/m-p/296888#M165076</link>
      <description>&lt;P&gt;thanks works fine&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 16:37:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Combine-search-query-with-a-lookup-file-with-one-common/m-p/296888#M165076</guid>
      <dc:creator>varunghai</dc:creator>
      <dc:date>2017-11-17T16:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine search query with a lookup file with one common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Combine-search-query-with-a-lookup-file-with-one-common/m-p/296889#M165077</link>
      <description>&lt;P&gt;Hi @varunghai,&lt;/P&gt;

&lt;P&gt;Glad to help you.&lt;/P&gt;

&lt;P&gt;Can you please accept the answer to close this question and upvote answer?&lt;/P&gt;

&lt;P&gt;Happy Splunking&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 16:40:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Combine-search-query-with-a-lookup-file-with-one-common/m-p/296889#M165077</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-17T16:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine search query with a lookup file with one common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Combine-search-query-with-a-lookup-file-with-one-common/m-p/296890#M165078</link>
      <description>&lt;P&gt;You should post this comment as a answer. Is the best query search for this problem.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 19:45:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Combine-search-query-with-a-lookup-file-with-one-common/m-p/296890#M165078</guid>
      <dc:creator>thiagodede</dc:creator>
      <dc:date>2017-11-17T19:45:34Z</dc:date>
    </item>
  </channel>
</rss>

