<?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: Obtaining statistics for messages with different ID's in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Obtaining-statistics-for-messages-with-different-ID-s/m-p/146195#M185198</link>
    <description>&lt;P&gt;Your adjustments seem to be entirely appropriate, especially since they achieved the desired results.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Aug 2015 15:20:12 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-08-11T15:20:12Z</dc:date>
    <item>
      <title>Obtaining statistics for messages with different ID's</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Obtaining-statistics-for-messages-with-different-ID-s/m-p/146192#M185195</link>
      <description>&lt;P&gt;I have logs from two apps to analyze. General a session of app interaction (as it is represented in logs) looks like this:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;App1&lt;/STRONG&gt; sends message to &lt;STRONG&gt;App2&lt;/STRONG&gt; (Let's say operation code is SEND1)&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;App2&lt;/STRONG&gt; receives this message (operation code is RECV1)&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;App2&lt;/STRONG&gt; processes this message and sends the response to &lt;STRONG&gt;App1&lt;/STRONG&gt; (operation code is SEND2)&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;App1&lt;/STRONG&gt; receives this message (operation code is RECV2)&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;App1&lt;/STRONG&gt; processes this message and sends the response to &lt;STRONG&gt;App2&lt;/STRONG&gt; (operation code is SEND3)&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Each message/response gets a new ID. Each response also has its corresponding request message ID.&lt;BR /&gt;
Log file of App1 consists of many chunks like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[timestamp]|SEND1|[XXX7]
[timestamp]|RECV2|[XXX8]
[timestamp]|SEND3|[XXX9]|[XXX8]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Log file of App2 consists of many chunks like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[timestamp]|RECV1|[XXX7]
[timestamp]|SEND2|[XXX8]|[XXX7]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where [XXXX] is some random message ID.&lt;/P&gt;

&lt;P&gt;Apps are asynchronous, so log records from few sessions can be mixed. &lt;BR /&gt;
So if you combine both logs, logically group them by message ID's and sort them by timestamps, you'll get something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;       log from App1                      log from App2
   [timestamp]|SEND1|[XXX7]
                                      [timestamp]|RECV1|[XXX7]
                                      [timestamp]|SEND2|[XXX8]|[XXX7]
   [timestamp]|RECV2|[XXX8]
   [timestamp]|SEND3|[XXX9]|[XXX8]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there a way to get statistics on average(by the second/minute/hour) delays between each pair of records?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2015 01:25:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Obtaining-statistics-for-messages-with-different-ID-s/m-p/146192#M185195</guid>
      <dc:creator>Maxim_Kirov</dc:creator>
      <dc:date>2015-07-29T01:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Obtaining statistics for messages with different ID's</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Obtaining-statistics-for-messages-with-different-ID-s/m-p/146193#M185196</link>
      <description>&lt;P&gt;Assuming that MessageID is a &lt;CODE&gt;multivalued field&lt;/CODE&gt; (if not, then do what you need to do to make sure that it is), then you can do it like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=App1 OR sourcetype=App2 | transaction MessageID mvlist=_time | streamstats current=t count AS serial | mvexpand _time | streamstats current=f last(_time) AS prevTime by serial | eval delta=_time-prevTime | stats avg(delta)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jul 2015 03:07:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Obtaining-statistics-for-messages-with-different-ID-s/m-p/146193#M185196</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-29T03:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: Obtaining statistics for messages with different ID's</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Obtaining-statistics-for-messages-with-different-ID-s/m-p/146194#M185197</link>
      <description>&lt;P&gt;I used something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=App1 OR sourcetype=App2 | eval code=_time+","+OperationCode | makemv delim="|" MessageID | transaction MessageID maxevents=5 | mvexpand code | rex field=code "(?&amp;lt;_time&amp;gt;\d+\.\d+),(?&amp;lt;OperationCode&amp;gt;\w+\d+)" | streamstats current=f last(_time) AS prevTime by MessageID | eval delta=_time-prevTime | stats avg(delta)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I didn't get why to use "streamstats current=t count AS serial". I hade to use "code" with mvexpand insted of "_time" because a transaction record has only one value for a _time field.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2015 15:05:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Obtaining-statistics-for-messages-with-different-ID-s/m-p/146194#M185197</guid>
      <dc:creator>Maxim_Kirov</dc:creator>
      <dc:date>2015-08-10T15:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Obtaining statistics for messages with different ID's</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Obtaining-statistics-for-messages-with-different-ID-s/m-p/146195#M185198</link>
      <description>&lt;P&gt;Your adjustments seem to be entirely appropriate, especially since they achieved the desired results.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 15:20:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Obtaining-statistics-for-messages-with-different-ID-s/m-p/146195#M185198</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-11T15:20:12Z</dc:date>
    </item>
  </channel>
</rss>

