<?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 Correlate field from earlier event with error in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Correlate-field-from-earlier-event-with-error/m-p/72018#M18004</link>
    <description>&lt;P&gt;I have a user who has a need to look for exceptions in a log file, and then figure out what order the error pertained to by looking for the most recently indexed previous event that defined a particular field.&lt;/P&gt;

&lt;P&gt;That is, the exception itself won't say anything about the order that caused it, but then again, the line that has the order on it doesn't show the exception (or any error, really).   This means I have to somehow tell Splunk to look backwards to find the data (field) that I really need to report on.&lt;/P&gt;

&lt;P&gt;How can I do this rather odd request?&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
    <pubDate>Wed, 26 Sep 2012 19:39:14 GMT</pubDate>
    <dc:creator>mfrost8</dc:creator>
    <dc:date>2012-09-26T19:39:14Z</dc:date>
    <item>
      <title>Correlate field from earlier event with error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Correlate-field-from-earlier-event-with-error/m-p/72018#M18004</link>
      <description>&lt;P&gt;I have a user who has a need to look for exceptions in a log file, and then figure out what order the error pertained to by looking for the most recently indexed previous event that defined a particular field.&lt;/P&gt;

&lt;P&gt;That is, the exception itself won't say anything about the order that caused it, but then again, the line that has the order on it doesn't show the exception (or any error, really).   This means I have to somehow tell Splunk to look backwards to find the data (field) that I really need to report on.&lt;/P&gt;

&lt;P&gt;How can I do this rather odd request?&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2012 19:39:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Correlate-field-from-earlier-event-with-error/m-p/72018#M18004</guid>
      <dc:creator>mfrost8</dc:creator>
      <dc:date>2012-09-26T19:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Correlate field from earlier event with error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Correlate-field-from-earlier-event-with-error/m-p/72019#M18005</link>
      <description>&lt;P&gt;You'd be able to get better help if you include some sample events. It's a bit unclear (to me) how the events are linked together...&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2012 21:02:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Correlate-field-from-earlier-event-with-error/m-p/72019#M18005</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2012-09-26T21:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Correlate field from earlier event with error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Correlate-field-from-earlier-event-with-error/m-p/72020#M18006</link>
      <description>&lt;P&gt;streamstats might actually help here.  Add the following to your search  (Change fields as needed)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| streamstats last(orderNumber) as last_order 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will create a new field called last_order for each event which will have the last seen orderNumber up to the point of that event occurring.  &lt;/P&gt;

&lt;P&gt;So something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_raw=orderNumber=123       last_order=123
_raw=some other message    last_order=123
_raw=orderNumber=456       last_order=456
_raw=another message       last_order=456
_raw=ERROR Message!        last_order=456
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which will associate the last seen order number with the error message even though there's no explicit correlation.&lt;/P&gt;

&lt;P&gt;(Note, you can add a 'by' clause to the streamstats if you need to restrict the aggregation somehow, say by host)&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/4.3.4/SearchReference/Streamstats"&gt;Streamstats Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2012 00:49:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Correlate-field-from-earlier-event-with-error/m-p/72020#M18006</guid>
      <dc:creator>emiller42</dc:creator>
      <dc:date>2012-09-27T00:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Correlate field from earlier event with error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Correlate-field-from-earlier-event-with-error/m-p/72021#M18007</link>
      <description>&lt;P&gt;I'd thought about that, but there's not much to show.   These are really horrible, user-generated "logs".   Picture what is effectively a dump of 1 long row from a database (no values) followed by a line or two later (no datestamps!) a java exception.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2012 14:19:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Correlate-field-from-earlier-event-with-error/m-p/72021#M18007</guid>
      <dc:creator>mfrost8</dc:creator>
      <dc:date>2012-09-27T14:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Correlate field from earlier event with error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Correlate-field-from-earlier-event-with-error/m-p/72022#M18008</link>
      <description>&lt;P&gt;Wow.  Very nice.   I looked at the streamstats command based on a previous post, but I found the fact that it said it was like stats to be confusing as I didn't want any kind of cumulative stats done on the events.&lt;/P&gt;

&lt;P&gt;That was what I was looking for.  Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2012 17:52:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Correlate-field-from-earlier-event-with-error/m-p/72022#M18008</guid>
      <dc:creator>mfrost8</dc:creator>
      <dc:date>2012-09-27T17:52:13Z</dc:date>
    </item>
  </channel>
</rss>

