<?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: splunk search returns multiple events along with matched event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/splunk-search-returns-multiple-events-along-with-matched-event/m-p/570656#M198867</link>
    <description>&lt;P&gt;It was set to auto, however I tried changing it to single event but still having same results&lt;/P&gt;</description>
    <pubDate>Tue, 12 Oct 2021 16:57:05 GMT</pubDate>
    <dc:creator>mbhima_nike</dc:creator>
    <dc:date>2021-10-12T16:57:05Z</dc:date>
    <item>
      <title>splunk search returns multiple events along with matched event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/splunk-search-returns-multiple-events-along-with-matched-event/m-p/570511#M198831</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I am making a search similar to this index=abc sourcetype=xyz "searchkeyword"&lt;BR /&gt;&lt;BR /&gt;Search result should contain only events that match the&amp;nbsp;searchkeyword like&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;timestamp&amp;gt;| trace ......searchkeyword.......&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;but getting events around that time along with matched events&lt;BR /&gt;&lt;BR /&gt;&amp;lt;timestamp&amp;gt;| trace ......someotherresult.......&lt;BR /&gt;&amp;lt;timestamp&amp;gt;| trace ......searchkeyword.......&lt;BR /&gt;&amp;lt;timestamp&amp;gt;| trace ......someotherresult.......&lt;BR /&gt;&amp;lt;timestamp&amp;gt;| trace ......someotherresult.......&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 18:36:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/splunk-search-returns-multiple-events-along-with-matched-event/m-p/570511#M198831</guid>
      <dc:creator>mbhima_nike</dc:creator>
      <dc:date>2021-10-11T18:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: splunk search returns multiple events along with matched event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/splunk-search-returns-multiple-events-along-with-matched-event/m-p/570521#M198836</link>
      <description>&lt;P&gt;Hi please check source type, and make sure each line consider as single event.&lt;/P&gt;&lt;P&gt;FYI: if it’s possible copy here result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 20:35:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/splunk-search-returns-multiple-events-along-with-matched-event/m-p/570521#M198836</guid>
      <dc:creator>indeed_2000</dc:creator>
      <dc:date>2021-10-11T20:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: splunk search returns multiple events along with matched event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/splunk-search-returns-multiple-events-along-with-matched-event/m-p/570656#M198867</link>
      <description>&lt;P&gt;It was set to auto, however I tried changing it to single event but still having same results&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 16:57:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/splunk-search-returns-multiple-events-along-with-matched-event/m-p/570656#M198867</guid>
      <dc:creator>mbhima_nike</dc:creator>
      <dc:date>2021-10-12T16:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: splunk search returns multiple events along with matched event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/splunk-search-returns-multiple-events-along-with-matched-event/m-p/570660#M198869</link>
      <description>&lt;P&gt;If I understand you correctly, for each event that fit your search you'd like to get that event along with some context - events from before and after this event, right?&lt;/P&gt;&lt;P&gt;Well, there is no such functionality as such. And it would be hard to define general function that would produce such results. But you can approach this from two angles. One is to find all matching events, get their timestamps and then use map command. I will not show this solution because that's very computationaly heavy, especially with many hits.&lt;/P&gt;&lt;P&gt;The other one is to write a subquery that limits the time based on your search conditions and run a query with this subquery limiting time periods. Kinda ugly, but should work. For example, with two second margin, you'd need something like that:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ &amp;lt;your base search&amp;gt; | eval earliest=_time-2 |eval latest=_time+2| fields earliest latest ] your_seach_conditions&lt;/LI-CODE&gt;&lt;P&gt;The only possibility, however, to limit the "margin" is by time. You can't chose 10 events forward and 10 events backwards. It simply doesn't work this way.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 17:55:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/splunk-search-returns-multiple-events-along-with-matched-event/m-p/570660#M198869</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-10-12T17:55:51Z</dc:date>
    </item>
  </channel>
</rss>

