<?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 do we fetch events after getting stats on the events , and we have no more of the events in the results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437489#M124565</link>
    <description>&lt;P&gt;Is there a way where i can fetch the correlation ids first and store them in a variable and use the variable in the query.&lt;BR /&gt;
for example a variable 'a' contains the index and correlationid details: &lt;BR /&gt;
a=(index="xyz" "POST /data" | stats values(correlationid) by index)&lt;BR /&gt;
Then use this in the actual query&lt;BR /&gt;
index="xyz" correlationid=a.get_correlationid| stats values(correlationid) min(_time) AS start max(_time) AS end | eval duration=end-start&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 23:01:34 GMT</pubDate>
    <dc:creator>rohanmiskin</dc:creator>
    <dc:date>2020-09-29T23:01:34Z</dc:date>
    <item>
      <title>How do we fetch events after getting stats on the events , and we have no more of the events in the results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437485#M124561</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I'm trying to filter on the logs of spring boot application.&lt;BR /&gt;
I want to calculate the time that a POST request takes.&lt;BR /&gt;
The search query im trying is&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;index="xyz" correlationid="1234"| stats values(correlationid) min(_time) AS start max(_time) AS end | eval duration=end-start&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;Here, I manually search for the events which are POST requests, then I get the correlation ID of that request, and use it in the query.&lt;/P&gt;

&lt;P&gt;The reason why im directly not using the string "POST" is that there are other logs too that get generated after a POST request is made till the POST returns status as successful. SO I have to consider all those events. Is there a way to search the correlation ID from all the events and then use the obtained correlation ID to fetch all the events with that correlation ID?&lt;/P&gt;

&lt;P&gt;Example of logs&lt;BR /&gt;
10.30 2019 | 1234 | POST /data&lt;BR /&gt;
10.31 2019 | 1234 | data verified&lt;BR /&gt;
10.32 2019 | 1234 | successfully posted data&lt;/P&gt;

&lt;P&gt;I need the duration 10.32-10.30=0.02&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:01:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437485#M124561</guid>
      <dc:creator>rohanmiskin</dc:creator>
      <dc:date>2020-09-29T23:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do we fetch events after getting stats on the events , and we have no more of the events in the results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437486#M124562</link>
      <description>&lt;P&gt;Hi @rohanmiskin &lt;/P&gt;

&lt;P&gt;You are on the right track but I think this is what you need to do:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="xyz" correlationid="1234"| stats min(_time) AS start max(_time) AS end by correlationid| eval duration=end-start&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;If that doesn't work for you, you can look into using the &lt;CODE&gt;transaction&lt;/CODE&gt; command but that has some performance implications. &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.3/SearchReference/Transaction"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.3/SearchReference/Transaction&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;All the best, Chris.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 20:22:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437486#M124562</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-01-30T20:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do we fetch events after getting stats on the events , and we have no more of the events in the results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437487#M124563</link>
      <description>&lt;P&gt;The answer to your question as you have literally asked it, just change &lt;CODE&gt;stats&lt;/CODE&gt; into &lt;CODE&gt;eventstats&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 20:54:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437487#M124563</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-30T20:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do we fetch events after getting stats on the events , and we have no more of the events in the results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437488#M124564</link>
      <description>&lt;P&gt;Is there a way where i can fetch the correlation ids first and store them in a variable and use the variable in the query.&lt;BR /&gt;
for example a variable 'a' contains the index and correlationid details: &lt;BR /&gt;
a=(index="xyz" "POST /data" | stats values(correlationid) by index)&lt;BR /&gt;
Then use this in the actual query&lt;BR /&gt;
index="xyz" correlationid=a.get_correlationid| stats values(correlationid) min(_time) AS start max(_time) AS end | eval duration=end-start&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:01:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437488#M124564</guid>
      <dc:creator>rohanmiskin</dc:creator>
      <dc:date>2020-09-29T23:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do we fetch events after getting stats on the events , and we have no more of the events in the results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437489#M124565</link>
      <description>&lt;P&gt;Is there a way where i can fetch the correlation ids first and store them in a variable and use the variable in the query.&lt;BR /&gt;
for example a variable 'a' contains the index and correlationid details: &lt;BR /&gt;
a=(index="xyz" "POST /data" | stats values(correlationid) by index)&lt;BR /&gt;
Then use this in the actual query&lt;BR /&gt;
index="xyz" correlationid=a.get_correlationid| stats values(correlationid) min(_time) AS start max(_time) AS end | eval duration=end-start&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:01:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437489#M124565</guid>
      <dc:creator>rohanmiskin</dc:creator>
      <dc:date>2020-09-29T23:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do we fetch events after getting stats on the events , and we have no more of the events in the results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437490#M124566</link>
      <description>&lt;P&gt;I am not sure what you mean but this may do it: &lt;CODE&gt;index="xyz" | eventstats min(_time) AS start max(_time) AS end by correlationid| eval duration=end-start | search  "POST /data"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;or &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="xyz" | eventstats min(_time) AS start max(_time) AS end by correlationid| eval duration=end-start | search  "POST /data" | table *&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 01:44:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437490#M124566</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-01-31T01:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do we fetch events after getting stats on the events , and we have no more of the events in the results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437491#M124567</link>
      <description>&lt;P&gt;@chrisyoungerjds . This was what i wanted. Thank you very much :).&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 05:30:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437491#M124567</guid>
      <dc:creator>rohanmiskin</dc:creator>
      <dc:date>2019-01-31T05:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do we fetch events after getting stats on the events , and we have no more of the events in the results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437492#M124568</link>
      <description>&lt;P&gt;Great to hear.  &lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 05:34:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-fetch-events-after-getting-stats-on-the-events-and-we/m-p/437492#M124568</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-01-31T05:34:27Z</dc:date>
    </item>
  </channel>
</rss>

