<?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 get timing data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-timing-data/m-p/310583#M93152</link>
    <description>&lt;P&gt;Try like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=whatever sourcetype=whichever
| rename COMMENT as "Add below line if ticketid is not extracted, else remove"
| rex "ticketid\"\:\s*(?&amp;lt;ticketid&amp;gt;\d+)"
| table _time ticketid  ...add other fields that you want to show..
| reverse
| streamstats values(_time) as prevtime by ticketid
| eval step_duration=prevtime-_time
| eventstats sum(step_duration) as total_durationo by ticketid
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 24 May 2017 19:11:09 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-05-24T19:11:09Z</dc:date>
    <item>
      <title>How to get timing data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-timing-data/m-p/310582#M93151</link>
      <description>&lt;P&gt;If I do &lt;CODE&gt;index=whatever&lt;/CODE&gt;, I get something that looks like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;2017-05-24T13:46:08Z|pegawifiview1495761514|8501114746901|G67BW48BD601389|None|viewDeviceWiFiNetworks_getResult|{"transactionid": "pegawifiview1495761514", "ticketid": 53400535}|{"request": {"method": "viewDeviceWiFiNetworks_getResult", "arguments": {"transactionid": "pegawifiview1495761514", "ticketid": 53400535}}, "response": {"status_code": "200", "status_message": "OK", "ticket_id": "" .......&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;There are many events, and some with the same &lt;CODE&gt;ticketid&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;What I need to do is this: for each &lt;CODE&gt;ticketid&lt;/CODE&gt;, determine how much time passed between each step.&lt;/P&gt;

&lt;P&gt;For example, if I put a particular ticketid in the search field, I get the following two events:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;2017-05-24T13:46:08Z|2017-05-24 13:45:59.921|1001000175904|b01041e6fafe|None|viewDeviceConnectedClients_getResult|{"transactionid": "2017-05-24 13:45:59.921", "ticketid": 53400657}|{"request": {"method": "viewDeviceConnectedClients_getResult", "arguments": {"transactionid": "2017-05-24 13:45:59.921", "ticketid": 53400657}}, "response": {"status_code": "200", "status_message": "OK", "ticket_id": "", "result": [{"macAddress": "2C:AE:2B:49:C2:86", "percentBWUtilization": "0", "signalStrength": -39, "connectedIdentifier": "2CAE2B49C286", "connectionType": "802.11", "activeDevice": 1, "deviceType": "Samsung Electronics Co.,Ltd", "networkIdentifier": "32", "deviceName": "android-9b9a1ce0ea0aeff1", "ipAddress": "192.168.0.28"}, {"macAddress": "24:0D:C2:AA:F5:BF", "percentBWUtilization": "0", "signalStrength": -59, "connectedIdentifier": "240DC2AAF5BF", "connectionType": "802.11", "activeDevice": 1, "deviceType": "", "networkIdentifier": "32", "deviceName": "android-2315ceb08818ecac", "ipAddress": "192.168.0.27"}, {"macAddress": "B0:10:41:E6:FB:00", "percentBWUtilization": "0", "signalStrength": 1, "connectedIdentifier": "B01041E6FB00", "connectionType": "Ethernet", "activeDevice": 0, "deviceType": "Hon Hai Precision Ind. Co.,Ltd.", "networkIdentifier": 0, "deviceName": "", "ipAddress": "192.168.0.10"}, {"macAddress": "24:0D:C2:F2:3C:FD", "percentBWUtilization": "0", "signalStrength": -41, "connectedIdentifier": "240DC2F23CFD", "connectionType": "802.11", "activeDevice": 1, "deviceType": "", "networkIdentifier": "32", "deviceName": "android-99f3d41f675c5616", "ipAddress": "192.168.0.26"}]}}&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;2017-05-24T13:46:00Z|2017-05-24 13:45:59.921|1001000175904|b01041e6fafe|None|viewDeviceConnectedClients|{"transactionid": "2017-05-24 13:45:59.921", "singleCPEidentifier": {"cpeid": "b01041e6fafe"}}|{"request": {"method": "viewDeviceConnectedClients", "arguments": {"transactionid": "2017-05-24 13:45:59.921", "singleCPEidentifier": {"cpeid": "b01041e6fafe"}}}, "response": {"status_code": "200", "status_message": "OK", "ticket_id": "53400657", "result": ""}}&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I can see from the timestamps that it took 8 seconds.&lt;/P&gt;

&lt;P&gt;And there may be more than 2 events for a given ticket ID. So I would need the total time. And I need it for every ticket ID in a general search.&lt;/P&gt;

&lt;P&gt;I am new to splunk and I have no idea how to do this. I have been searching and trying some things, but I am pretty lost. Any help would be appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 18:40:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-timing-data/m-p/310582#M93151</guid>
      <dc:creator>Physiker</dc:creator>
      <dc:date>2017-05-24T18:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get timing data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-timing-data/m-p/310583#M93152</link>
      <description>&lt;P&gt;Try like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=whatever sourcetype=whichever
| rename COMMENT as "Add below line if ticketid is not extracted, else remove"
| rex "ticketid\"\:\s*(?&amp;lt;ticketid&amp;gt;\d+)"
| table _time ticketid  ...add other fields that you want to show..
| reverse
| streamstats values(_time) as prevtime by ticketid
| eval step_duration=prevtime-_time
| eventstats sum(step_duration) as total_durationo by ticketid
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 May 2017 19:11:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-timing-data/m-p/310583#M93152</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-05-24T19:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to get timing data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-timing-data/m-p/310584#M93153</link>
      <description>&lt;P&gt;Nice. But &lt;CODE&gt;_time&lt;/CODE&gt; is shown similar to this: &lt;CODE&gt;2017-05-24 12:55:24&lt;/CODE&gt; , and &lt;CODE&gt;prevtime&lt;/CODE&gt; is shown similar to this: &lt;CODE&gt;1495644925&lt;/CODE&gt;. So &lt;CODE&gt;step_duration&lt;/CODE&gt; and &lt;CODE&gt;total_dutation&lt;/CODE&gt; are always 0.&lt;/P&gt;

&lt;P&gt;I tried &lt;CODE&gt;eval step_duration=prevtime-values(_time)&lt;/CODE&gt;, but it didn't work.&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2017 13:05:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-timing-data/m-p/310584#M93153</guid>
      <dc:creator>Physiker</dc:creator>
      <dc:date>2017-05-25T13:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to get timing data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-timing-data/m-p/310585#M93154</link>
      <description>&lt;P&gt;An alternative could be to use the transaction SPL command. In the link it states&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;the transaction command adds two fields to the raw events, duration and eventcount. The values in the duration field show the difference between the timestamps for the first and last events in the transaction. The values in the eventcount field show the number of events in the transaction.&lt;BR /&gt;
So as starting point you could try &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;PRE&gt;&lt;CODE&gt;index=whatever sourcetype=whichever
| transaction ticketid
| table ticketid duration eventcount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Dave&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2017 13:32:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-timing-data/m-p/310585#M93154</guid>
      <dc:creator>davebrooking</dc:creator>
      <dc:date>2017-05-25T13:32:05Z</dc:date>
    </item>
  </channel>
</rss>

