<?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 get time from two different sourcetypes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707323#M239250</link>
    <description>&lt;P&gt;Assuming you already have filenames extracted, then try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval file_name=coalesce('FileTransfer.FileName', file_name)
| stats values(eval(if(sourcetype="filecopy",_time,null()))) as FileCopyLocation values(eval(if(sourcetype="transfer",_time,null()))) as TargetLocation by file_name
| eval FileCopyLocation=strftime(FileCopyLocation,"%F %T")
| eval TargetLocation=strftime(TargetLocation, "%F %T")
| fillnull TargetLocation value="Pending"&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 19 Dec 2024 18:13:00 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2024-12-19T18:13:00Z</dc:date>
    <item>
      <title>How to get time from two different sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707286#M239239</link>
      <description>&lt;P&gt;I am trying to track file transfers from one location to another.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Flow: Files are copied to File copy location -&amp;gt; Target Location&lt;/P&gt;&lt;P&gt;Both File copy location and Target location logs are in the same index but each has it own sourcetype.&lt;/P&gt;&lt;P&gt;File copy location events has logs for each file but Target location has a logs which has multiple files names.&lt;/P&gt;&lt;P&gt;Log format of filecopy location:&lt;/P&gt;&lt;P&gt;2024-12-18 17:02:50&amp;nbsp;, file_name="XYZ.csv",&amp;nbsp; file copy success&amp;nbsp;&lt;/P&gt;&lt;P&gt;2024-12-18 17:02:58, file_name="ABC.zip", file copy success&amp;nbsp;&lt;/P&gt;&lt;P&gt;2024-12-18 17:03:38, file_name="123.docx", file copy success&lt;/P&gt;&lt;P&gt;2024-12-18 18:06:19, file_name="143.docx", file copy success&lt;/P&gt;&lt;P&gt;Log format of Target Location:&lt;/P&gt;&lt;P&gt;2024-12-18 17:30:10&amp;nbsp;&amp;lt;FileTransfer status="success&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;FileName&amp;gt;XYZ.csv&amp;lt;/FileName&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;FileName&amp;gt;ABC.zip&amp;lt;/FileName&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;FileName&amp;gt;123.docx&amp;lt;/FileName&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/FileTransfer&amp;gt;&lt;/P&gt;&lt;P&gt;Desired result:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; File Name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FileCopyLocation&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Target Location&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;XYZ.csv&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;2024-12-18 17:02:50&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;2024-12-18 17:30:10&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;ABC.zip&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2024-12-18 17:02:58&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;2024-12-18 17:30:10&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;123.docx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2024-12-18 17:03:38&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2024-12-18 17:30:10&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;143.docx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2024-12-18 18:06:19&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Pending&lt;/P&gt;&lt;P&gt;I want to avoid join.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 14:04:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707286#M239239</guid>
      <dc:creator>t_splunk_d</dc:creator>
      <dc:date>2024-12-19T14:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time from two different sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707288#M239240</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/41046"&gt;@t_splunk_d&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;you can use the transaction command:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=your_index sourcetype IN (sourcetype1, sourcetype2)
| eval FileName=coalesce(file_name, FileName)
| stats earliest(_time) AS FileCopyLocation latest(_time) AS TargetLocation BY FileName 
| eval FileCopyLocation=strftime(FileCopyLocation,"%Y-%m-%d %H:%M:$S"), TargetLocation=strftime(TargetLocation,"%Y-%m-%d %H:%M:$S")
| fillnull value="Pending" TargetLocation
| table FileName FileCopyLocation TargetLocation&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 14:11:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707288#M239240</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-12-19T14:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time from two different sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707309#M239245</link>
      <description>&lt;P&gt;Thank you for the help. I always get null for&amp;nbsp; TargetLocation in stats and thus showing "Pending"&lt;BR /&gt;I notice that latest(TargetLocation) has multiple values and null is the latest. Is there a way to eliminate null so that the latest time can be displayed?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 16:33:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707309#M239245</guid>
      <dc:creator>t_splunk_d</dc:creator>
      <dc:date>2024-12-19T16:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time from two different sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707312#M239246</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp; Can you please help?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 17:18:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707312#M239246</guid>
      <dc:creator>t_splunk_d</dc:creator>
      <dc:date>2024-12-19T17:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time from two different sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707314#M239247</link>
      <description>&lt;P&gt;Transaction command is costly and it has limitations for wider timeframe and larger datasets.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 17:24:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707314#M239247</guid>
      <dc:creator>t_splunk_d</dc:creator>
      <dc:date>2024-12-19T17:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time from two different sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707323#M239250</link>
      <description>&lt;P&gt;Assuming you already have filenames extracted, then try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval file_name=coalesce('FileTransfer.FileName', file_name)
| stats values(eval(if(sourcetype="filecopy",_time,null()))) as FileCopyLocation values(eval(if(sourcetype="transfer",_time,null()))) as TargetLocation by file_name
| eval FileCopyLocation=strftime(FileCopyLocation,"%F %T")
| eval TargetLocation=strftime(TargetLocation, "%F %T")
| fillnull TargetLocation value="Pending"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 19 Dec 2024 18:13:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707323#M239250</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-12-19T18:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time from two different sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707326#M239251</link>
      <description>&lt;P&gt;Still i get "Pending" for all the files even though it was success and timestamp is there.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 18:53:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707326#M239251</guid>
      <dc:creator>t_splunk_d</dc:creator>
      <dc:date>2024-12-19T18:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time from two different sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707330#M239252</link>
      <description>&lt;P&gt;Sounds like the file names don't completely match or perhaps the TargetLocation event doesn't have it in? Is it always the same file or at least file position e.g. always the last in the list? Or possibly files after a particular point in the XML message. Without being able to see your data, it is a bit difficult to determine what might be wrong.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 20:15:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707330#M239252</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-12-19T20:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time from two different sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707333#M239254</link>
      <description>&lt;P&gt;Filenames match exactly. Targetlocation has the file name. Like I have it in my example the file names are different. It is not related to position.&lt;/P&gt;&lt;P&gt;When&amp;nbsp; modify the stats to&amp;nbsp; values(file_name) i get results but it is so weird results&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 20:30:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-from-two-different-sourcetypes/m-p/707333#M239254</guid>
      <dc:creator>t_splunk_d</dc:creator>
      <dc:date>2024-12-19T20:30:27Z</dc:date>
    </item>
  </channel>
</rss>

