<?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 associated query according to the context in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/associated-query-according-to-the-context/m-p/171528#M49160</link>
    <description>&lt;P&gt;My raw data is like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   FieldA  | FieldB  | FieldC | FieldD 
1439638106 | 1.1.1.1 | 21 | 500
1439637106 | 1.1.1.1 | 21 | 200
1439636106 | 2.2.2.2 | 23 | 200
1439635106 | 3.3.3.3 | 21 | 500 
1439634106 | 4.4.4.4 | 25 | 200  
1439633106 | 3.3.3.3 | 21 | 200
1439631106 | 5.5.5.5 | 28 | 500
1439532106 | 3.3.3.3 | 21 | 200 
.......
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;FieldA is a timestamp field&lt;BR /&gt;
1、&lt;BR /&gt;
I want to find the FieldD=200 by FieldB,FieldC, but in the next time (FieldA  +1h@h), FieldD!=500&lt;/P&gt;

&lt;P&gt;so the result is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   FieldA  | FieldB  | FieldC | FieldD 
1439636106 | 2.2.2.2 | 23 | 200
1439634106 | 4.4.4.4 | 25 | 200  
.......
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2、&lt;BR /&gt;
I want to find the FieldD=500 by FieldB,FieldC, and in the previous time (FieldA  -1h@h), FieldD=200&lt;/P&gt;

&lt;P&gt;so the result is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   FieldA  | FieldB  | FieldC | FieldD 
1439638106 | 1.1.1.1 | 21 | 500
1439637106 | 1.1.1.1 | 21 | 200
1439635106 | 3.3.3.3 | 21 | 500  
1439633106 | 3.3.3.3 | 21 | 200
.......
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I write the search query ?&lt;/P&gt;</description>
    <pubDate>Sun, 16 Aug 2015 07:30:01 GMT</pubDate>
    <dc:creator>caili</dc:creator>
    <dc:date>2015-08-16T07:30:01Z</dc:date>
    <item>
      <title>associated query according to the context</title>
      <link>https://community.splunk.com/t5/Splunk-Search/associated-query-according-to-the-context/m-p/171528#M49160</link>
      <description>&lt;P&gt;My raw data is like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   FieldA  | FieldB  | FieldC | FieldD 
1439638106 | 1.1.1.1 | 21 | 500
1439637106 | 1.1.1.1 | 21 | 200
1439636106 | 2.2.2.2 | 23 | 200
1439635106 | 3.3.3.3 | 21 | 500 
1439634106 | 4.4.4.4 | 25 | 200  
1439633106 | 3.3.3.3 | 21 | 200
1439631106 | 5.5.5.5 | 28 | 500
1439532106 | 3.3.3.3 | 21 | 200 
.......
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;FieldA is a timestamp field&lt;BR /&gt;
1、&lt;BR /&gt;
I want to find the FieldD=200 by FieldB,FieldC, but in the next time (FieldA  +1h@h), FieldD!=500&lt;/P&gt;

&lt;P&gt;so the result is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   FieldA  | FieldB  | FieldC | FieldD 
1439636106 | 2.2.2.2 | 23 | 200
1439634106 | 4.4.4.4 | 25 | 200  
.......
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2、&lt;BR /&gt;
I want to find the FieldD=500 by FieldB,FieldC, and in the previous time (FieldA  -1h@h), FieldD=200&lt;/P&gt;

&lt;P&gt;so the result is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   FieldA  | FieldB  | FieldC | FieldD 
1439638106 | 1.1.1.1 | 21 | 500
1439637106 | 1.1.1.1 | 21 | 200
1439635106 | 3.3.3.3 | 21 | 500  
1439633106 | 3.3.3.3 | 21 | 200
.......
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I write the search query ?&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2015 07:30:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/associated-query-according-to-the-context/m-p/171528#M49160</guid>
      <dc:creator>caili</dc:creator>
      <dc:date>2015-08-16T07:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: associated query according to the context</title>
      <link>https://community.splunk.com/t5/Splunk-Search/associated-query-according-to-the-context/m-p/171529#M49161</link>
      <description>&lt;P&gt;I think you want to use &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.4/SearchReference/Autoregress"&gt;autoregress&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | autoregress p=1 FieldD as Next_FieldD | where FieldD=200 AND Next_FieldD!=500 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | sort FieldA | autoregress p=1 FieldD AS Prev_FieldD | where FieldD=500 AND Prev_FieldD=200
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Not sure if you want to see those results in the same search or separate, but I think you can pipe to autoregress to get the next field, re-sort by FieldA, autoregress again to get the prev field, then pipe to where to filter on those two scenarios.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2015 12:18:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/associated-query-according-to-the-context/m-p/171529#M49161</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2015-08-16T12:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: associated query according to the context</title>
      <link>https://community.splunk.com/t5/Splunk-Search/associated-query-according-to-the-context/m-p/171530#M49162</link>
      <description>&lt;P&gt;I think the autoregress command does not meet the requirements, because I don't know the "p".&lt;/P&gt;

&lt;P&gt;I want query  according to the FieldA (time)&lt;/P&gt;

&lt;P&gt;Thank you for your kindness~&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2015 13:13:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/associated-query-according-to-the-context/m-p/171530#M49162</guid>
      <dc:creator>caili</dc:creator>
      <dc:date>2015-08-16T13:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: associated query according to the context</title>
      <link>https://community.splunk.com/t5/Splunk-Search/associated-query-according-to-the-context/m-p/171531#M49163</link>
      <description>&lt;P&gt;oh ok, I think I misunderstood the requirement.  If you sort by B, then C then A, will the events be in an order where autoregress could work?  Or are the timestamps random enough where you still can't rely on looking before/after the current event?&lt;/P&gt;

&lt;P&gt;Still not sure if I understand the data set well enough to give this a shot....&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2015 14:39:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/associated-query-according-to-the-context/m-p/171531#M49163</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2015-08-16T14:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: associated query according to the context</title>
      <link>https://community.splunk.com/t5/Splunk-Search/associated-query-according-to-the-context/m-p/171532#M49164</link>
      <description>&lt;P&gt;I can use map command to meet  the second requirement, but the search speed  is slow&lt;/P&gt;

&lt;P&gt;And the first one may be need  using  "NOT"  , but I'm unable to write the query&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2015 04:47:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/associated-query-according-to-the-context/m-p/171532#M49164</guid>
      <dc:creator>caili</dc:creator>
      <dc:date>2015-08-17T04:47:39Z</dc:date>
    </item>
  </channel>
</rss>

