<?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 create a search for matching next line? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653192#M225731</link>
    <description>&lt;P&gt;True but the data is together.&lt;/P&gt;&lt;P&gt;Another approach could be this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| streamstats list(_raw) as raw first(_raw) as first_raw window=2
| regex first_raw="Location:BBB"
| fields - first_raw
| mvexpand raw
| rename raw as _raw&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 04 Aug 2023 09:40:26 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-08-04T09:40:26Z</dc:date>
    <item>
      <title>How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653103#M225685</link>
      <description>&lt;P&gt;Hi Splunk Experts,&lt;/P&gt;
&lt;P&gt;I want to search for a word and then print the current matching line &amp;amp; the immediate next line. Kindly assist. Thanks in advance!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: My events are Single-Line events.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 21:09:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653103#M225685</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-08-03T21:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653111#M225688</link>
      <description>&lt;P&gt;The question is a bit less straightforward that you could expect.&lt;/P&gt;&lt;P&gt;1. In general, Splunk works on one event at a time. You can't make it "relate" one event to another. You have to use splunk magic to either group events into aggregate rows of results or copy over data from one event to another.&lt;/P&gt;&lt;P&gt;2. Another thing is what you mean by "next".&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 21:44:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653111#M225688</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-08-03T21:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653121#M225692</link>
      <description>&lt;P&gt;I second what &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt; said.&amp;nbsp; There isn't really a concept of "next" in Splunk.&amp;nbsp; Events return in (roughly) time order based on the search criteria.&amp;nbsp; Depending on how the data arrived in the indexers, events from multiple sources or hosts could be interleaved.&amp;nbsp; The immediately next event could be unrelated to the "word" event.&lt;/P&gt;&lt;P&gt;Tell us more the use case and perhaps we can come with another solution.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 00:22:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653121#M225692</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-08-04T00:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653124#M225694</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Yes, I agree with your statements. I don't want to relate events. Based on the search match events, I want that matched event along with next line. Which we usually see in the Show source.&lt;BR /&gt;&lt;BR /&gt;Ex:&lt;BR /&gt;Timestamp: Location:AAA&lt;BR /&gt;Timestamp: Address:AAAAA.....&lt;BR /&gt;&lt;BR /&gt;Timestamp: Location:BBB&lt;BR /&gt;Timestamp: Address:BBBBB.....&lt;BR /&gt;&lt;BR /&gt;Timestamp: Location:CCC&lt;BR /&gt;Timestamp: Address:CCCCC.....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;From the above example, If I search for specific Location='BBB', based on the matched event. I want to display below matched event and it's immediate next line which contains additional information I'm looking for, this can be achieved using regex/ rex patterns. But I'm missing something "rex field=_raw "&lt;STRONG&gt;[^\r|\n\r|\n](?&amp;lt;MatchedPatterns&amp;gt;.*[\r|\n\r|\n]?.*)&lt;/STRONG&gt;, it's not giving me the exact result I'm looking for, even if there are better solutions I would be happy to know about it.&lt;BR /&gt;Timestamp: Location:BBB&lt;BR /&gt;Timestamp: Address:BBBBB.....&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 03:50:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653124#M225694</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-08-04T03:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653163#M225707</link>
      <description>&lt;P&gt;This doesn't answer the essential question that&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;asked. &amp;nbsp;Let me ask in a different way: Are these illustrated lines in the same event or two separate events?&lt;/P&gt;&lt;TABLE border="1" width="35.22727272727273%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="100%"&gt;&lt;SPAN&gt;Timestamp: Location:AAA&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Timestamp: Address:AAAAA.....&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;If they are in the same event, you need to explain the relevancy of the question because you automatically get the "second line".&lt;/P&gt;&lt;P&gt;If they are in separate events, as &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;already explained, there is no such a thing as "next line". &amp;nbsp;You have to tell Splunk what else you want. &amp;nbsp;Is it the next increment in _time? &amp;nbsp;Is it the next largest Timestamp (which can be calculated into numeric time)? &amp;nbsp;Or something totally different? (It is important to realize that whether you want to relate events or not, you are relating the first event with the second event. &amp;nbsp;You have to tell Splunk what that relationship is. &amp;nbsp;Is there some other fields/keys that relate the second event to the first?)&lt;/P&gt;&lt;P&gt;In all likeliness, you seem to be asking for a &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transaction" target="_blank" rel="noopener"&gt;transaction&lt;/A&gt;-like relationship, i.e., if I see a Location that meets my criteria, I want to see the &lt;EM&gt;next&lt;/EM&gt;&amp;nbsp;Address event. &amp;nbsp;In pseudo code, something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| sort - _time
| transaction startswith=Location endswith=Address ``` add key fields if any ```
| where &amp;lt;whatever criteria on Location&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 07:29:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653163#M225707</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-08-04T07:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653166#M225709</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| streamstats window=2 current=f last(_raw) as previous_raw
| regex previous_raw="match string"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 04 Aug 2023 07:40:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653166#M225709</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-04T07:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653190#M225729</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks, but this gives the same matching event, not adding the next immediate line.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 09:32:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653190#M225729</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-08-04T09:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653191#M225730</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;, Generally I'm looking for what we see in the Events -&amp;gt; Event Actions -&amp;gt; Show Source.&amp;nbsp;&lt;BR /&gt;I can't do it by _time, because we've multiple host &amp;amp; source which could overlap. Unfortunately so such fields/ keys to identify it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 09:37:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653191#M225730</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-08-04T09:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653192#M225731</link>
      <description>&lt;P&gt;True but the data is together.&lt;/P&gt;&lt;P&gt;Another approach could be this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| streamstats list(_raw) as raw first(_raw) as first_raw window=2
| regex first_raw="Location:BBB"
| fields - first_raw
| mvexpand raw
| rename raw as _raw&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 04 Aug 2023 09:40:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653192#M225731</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-04T09:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653194#M225733</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;, tried but still it's displaying only the Event matched line.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=main Location:BBB
| streamstats list(_raw) as raw first(_raw) as first_raw window=2
| regex first_raw="Location:BBB"
| fields - first_raw
| mvexpand raw
| rename raw as _raw&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 10:10:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653194#M225733</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-08-04T10:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653195#M225734</link>
      <description>&lt;P&gt;This view shows you events in the (reverse? I don't remember) order as they are being returned by the search. But there is no guarantee that they will always be in the same order unless there is an explicit or implicit factor ordering them.&lt;/P&gt;&lt;P&gt;Results are by default (unless you sort them otherwise) returned in a reverse chronological order. But if you have two events with the exact same timestamp, I don't think there is ah officially defined and known mechanics for ordering them.&lt;/P&gt;&lt;P&gt;You have to remember that Splunk can consists of many servers and your two "consecutive" events can be indexed on different servers and returned in different order each time you run the search because on one occasion one of the indexers will be quicker to respond but another time it will be the other one.&lt;/P&gt;&lt;P&gt;That's why source onboarding is an important process. If those two lines are generally two parts of the same event happening on the source machine - it might mean that they should be ingested together as a single multiline event. Otherwise in order to reliably correlate multiple events regarding single something (operation, error, entity, whatever...) you need some form of identifier that appears in every of those events.&lt;/P&gt;&lt;P&gt;If you are absolutely sure that your event stream contains monotonic timestamps and multiple "packs of events" are not interleaved you can often use the time ordering. But as I said - multiple events indexed under the exactly same timestamp don't have a guaranteed search order.&lt;/P&gt;&lt;P&gt;I privately suspect that they might be returned in an index-time based "suborder" but I have no docs to support it.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 10:35:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653195#M225734</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-08-04T10:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653199#M225737</link>
      <description>&lt;P&gt;Here is a runanywhere example showing it working&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ITWhisperer_0-1691148729593.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26636i410FE126E7DFDFE6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ITWhisperer_0-1691148729593.png" alt="ITWhisperer_0-1691148729593.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 11:32:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653199#M225737</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-04T11:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653304#M225778</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&amp;amp; apologies for delayed response.&lt;BR /&gt;&lt;BR /&gt;If I do a search with 'Location:BBB', I won't see the 'Timestamp: Address:BBBBB.....' in search event result. That's why streamstats not working in my case?&lt;/P&gt;</description>
      <pubDate>Sat, 05 Aug 2023 08:48:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653304#M225778</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-08-05T08:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653306#M225780</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;. May be we have a something in place to display the preceeding &amp;amp; following lines of events which is always correct. I don't have admittance to see how this has been done and the team has the respective privilege are not much supportive. That's why trying to find a solution by search.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Aug 2023 08:55:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653306#M225780</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-08-05T08:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653309#M225781</link>
      <description>&lt;P&gt;It may depend on when you are doing the search - please share your search which is failing to find the events you are looking for&lt;/P&gt;</description>
      <pubDate>Sat, 05 Aug 2023 10:00:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653309#M225781</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-05T10:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653310#M225782</link>
      <description>&lt;P&gt;This is my realtime scenario. I search for a Generic exceptions like NPE, ArrayOutOfBoundExceptions, etc.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;My Search:&amp;nbsp;&lt;/STRONG&gt;index=main .*NullPointerException.*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Search Results:&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Event 1&lt;/STRONG&gt;: From host:XXX source:xxx&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;16:19:33 [WARNING] Failed to handle packet: java.lang.NullPointerException &lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;Event 2:&amp;nbsp;&lt;/STRONG&gt;From host:XXX source:xxx&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;java.lang.NullPointerException &lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;Event 3:&amp;nbsp;&lt;/STRONG&gt;From host:YYY source:yyy&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;java.lang.NullPointerException &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*********************************************&lt;BR /&gt;&lt;STRONG&gt;Results I'm expecting:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Event 2:&amp;nbsp;From host:XXX source:xxx&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;16:19:33 [WARNING] Failed to handle packet: java.lang.NullPointerException 
java.lang.NullPointerException &lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;Event 2:&amp;nbsp;&lt;/STRONG&gt;From host:XXX source:xxx&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;java.lang.NullPointerException 
at com.Khorn.TerrainControl.Generator.ObjectSpawner.populate(ObjectSpawner.java:128)&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;Event 3:&amp;nbsp;&lt;/STRONG&gt;From host:YYY source:yyy&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;java.lang.NullPointerException Caused
at app15a.action.CreateCustomerAction.execute(CreateCustomerAction.java:54)
at&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;**************************************************&lt;BR /&gt;&lt;STRONG&gt;Real Logs From host:XXX source:xxx&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;16:19:33 [WARNING] Failed to handle packet: java.lang.NullPointerException 
java.lang.NullPointerException 
at com.Khorn.TerrainControl.Generator.ObjectSpawner.populate(ObjectSpawner.java:128) 
at net.minecraft.server.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:178) 
at net.minecraft.server.Chunk.a(Chunk.java:820)
 at net.minecraft.server.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:96)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;&lt;STRONG&gt;Real Logs From host:YYY source:yyy&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;11:27:19,522 INFO  app15a.action.CreateCustomerAction - an exception occurred! ============================== 
java.lang.NullPointerException Caused
	at app15a.action.CreateCustomerAction.execute(CreateCustomerAction.java:54)
	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;***********************************************&lt;BR /&gt;&lt;BR /&gt;Tried alternative exhaustive search using below query but even this is bringing the same search result&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=main
| rex field=_raw "(?&amp;lt;Ex&amp;gt;(.*NullPointerException.*[\r\n].+[^\r\n]))"
| where len(Ex)!=0
| table Ex&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Aug 2023 10:28:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653310#M225782</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-08-05T10:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653313#M225783</link>
      <description>&lt;P&gt;Here is a runanywhere example with your logs.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| fields - _time
| eval _raw="16:19:33 [WARNING] Failed to handle packet: java.lang.NullPointerException 
java.lang.NullPointerException 
at com.Khorn.TerrainControl.Generator.ObjectSpawner.populate(ObjectSpawner.java:128) 
at net.minecraft.server.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:178) 
at net.minecraft.server.Chunk.a(Chunk.java:820)
 at net.minecraft.server.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:96)
11:27:19,522 INFO  app15a.action.CreateCustomerAction - an exception occurred! ============================== 
java.lang.NullPointerException Caused
	at app15a.action.CreateCustomerAction.execute(CreateCustomerAction.java:54)
	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)"
| multikv noheader=t 
| fields _raw
| streamstats list(_raw) as raw first(_raw) as first_raw window=2
| regex first_raw="NullPointerException"
| where mvcount(raw) &amp;gt; 1
| fields - first_raw
| mvexpand raw
| rename raw as _raw&lt;/LI-CODE&gt;&lt;P&gt;Things to note is the where command was added to remove the first event since it has no previous&lt;/P&gt;&lt;P&gt;Also, depending on what you are trying to see, the mvexpand (and rename) could be removed to show how the raw events are paired, so when NullPointerException appears on adjacent lines, it is clear why the line is repeated.&lt;/P&gt;&lt;P&gt;Finally, you might want to look at your ingestion so that all the lines from the same "event" are kept together in a single event e.g. breaking at the timestamp not every new line.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Aug 2023 11:07:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653313#M225783</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-05T11:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653315#M225784</link>
      <description>&lt;P&gt;Very Much Thanks to you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;. It worked perfectly, when I didn't add 'NullPointerException' in my main search. But the Events it searched against 2 mins window was (23,976,134) which took lot of time. If I expand the window to 15 mins. The search got aut-cancelled. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; Is there any other work-arounds I could do in this situation.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Aug 2023 11:42:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653315#M225784</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-08-05T11:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653317#M225785</link>
      <description>&lt;P&gt;Summary indexes are a good way of extracting useful information so that subsequent searches are faster, for example, you could run a report every minute to find these occurrences and put them in a summary index. You could then use the summary index to reframe the time search on your main index if you need more information from it.&lt;/P&gt;&lt;P&gt;The other option I already mentioned is to change your ingestion so that the multi-line faults are indexed as a single event rather than being spread across multiple events, which might improve your search time for these faults.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Aug 2023 12:56:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653317#M225785</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-05T12:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search for matching next line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653319#M225786</link>
      <description>&lt;P&gt;OK. I know that it wasn't your question but these are not supposed to be separate events. These are simply subsequent lines of a single multi-line event and your source is not properly onboarded. You should fix your line breaking (and maybe timestamp recognition because I suspect it is broken as well). This will solve more problems than just "next line".&lt;/P&gt;</description>
      <pubDate>Sat, 05 Aug 2023 13:29:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-matching-next-line/m-p/653319#M225786</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-08-05T13:29:08Z</dc:date>
    </item>
  </channel>
</rss>

