<?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: Reading same field from multiple log files in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Reading-same-field-from-multiple-log-files/m-p/467818#M131686</link>
    <description>&lt;P&gt;One cannot rename fields in a base search (the part before the first &lt;CODE&gt;|&lt;/CODE&gt;).  That's done using &lt;CODE&gt;eval&lt;/CODE&gt; or &lt;CODE&gt;rename&lt;/CODE&gt;.&lt;BR /&gt;
Also, since the start and end times are in separate events, you will not find both 'start' and 'end' together.  The starting and ending events must be combined via some common field.  Is there a transaction ID or other field that can be used to join the two events?&lt;/P&gt;</description>
    <pubDate>Tue, 07 Apr 2020 13:08:10 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-04-07T13:08:10Z</dc:date>
    <item>
      <title>Reading same field from multiple log files</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reading-same-field-from-multiple-log-files/m-p/467817#M131685</link>
      <description>&lt;P&gt;I have 2 log files from different sources. Both log files have statements either indicating a  "Transaction-Start" or  "Transaction-End" . "EPOCH" is a field common in both log files indicating the timestamp of either start or end of a transaction.&lt;/P&gt;

&lt;P&gt;Now I want to write a query that fetches EPOCH of "Transaction-Start" from log file 1, call it as, say &lt;CODE&gt;start&lt;/CODE&gt; and EPOCH of "Transaction-End" from log file 2, call it as, say &lt;CODE&gt;end&lt;/CODE&gt;. Following this, I want to find the difference between &lt;CODE&gt;end&lt;/CODE&gt; and &lt;CODE&gt;start&lt;/CODE&gt; and display only those logs with a difference higher than a threshold, say &lt;CODE&gt;10000&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;What I have tried writing is below :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=someIndex ENVIRONMENT="someEnv" (source="/log/source1.log" "Transaction-Start" "EPOCH" as start) OR (source="/log/source2.log" "Transaction-End" "EPOCH" as end) 
    | eval difference=end-start 
    | where difference&amp;gt;10000
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this is not working. Looking for help in composing this search in the right way.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 12:50:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reading-same-field-from-multiple-log-files/m-p/467817#M131685</guid>
      <dc:creator>hegdevageesh</dc:creator>
      <dc:date>2020-04-07T12:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Reading same field from multiple log files</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reading-same-field-from-multiple-log-files/m-p/467818#M131686</link>
      <description>&lt;P&gt;One cannot rename fields in a base search (the part before the first &lt;CODE&gt;|&lt;/CODE&gt;).  That's done using &lt;CODE&gt;eval&lt;/CODE&gt; or &lt;CODE&gt;rename&lt;/CODE&gt;.&lt;BR /&gt;
Also, since the start and end times are in separate events, you will not find both 'start' and 'end' together.  The starting and ending events must be combined via some common field.  Is there a transaction ID or other field that can be used to join the two events?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 13:08:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reading-same-field-from-multiple-log-files/m-p/467818#M131686</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-04-07T13:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reading same field from multiple log files</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reading-same-field-from-multiple-log-files/m-p/467819#M131687</link>
      <description>&lt;P&gt;@richgalloway, yes, there is a "TXID" field that is common field in both log files.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 13:13:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reading-same-field-from-multiple-log-files/m-p/467819#M131687</guid>
      <dc:creator>hegdevageesh</dc:creator>
      <dc:date>2020-04-07T13:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Reading same field from multiple log files</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reading-same-field-from-multiple-log-files/m-p/467820#M131688</link>
      <description>&lt;P&gt;Try this.  It assumes EPOCH is an integer.  If it isn't then you'll need to use &lt;CODE&gt;strptime&lt;/CODE&gt; to convert it into an integer.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=someIndex ENVIRONMENT="someEnv" EPOCH=* (source="/log/source1.log" "Transaction-Start") OR (source="/log/source2.log" "Transaction-End") 
| eval start = if(source="/log/source1.log", EPOCH, null()), end = if (source="/log/source2.log", EPOCH, null())
| stats values(*) as * by TXID
| eval difference=end-start 
| where difference&amp;gt;10000
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Apr 2020 13:28:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reading-same-field-from-multiple-log-files/m-p/467820#M131688</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-04-07T13:28:19Z</dc:date>
    </item>
  </channel>
</rss>

