<?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: Sankey Diagram - Custom Visualization: One event in multiple transactions in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Sankey-Diagram-Custom-Visualization-One-event-in-multiple/m-p/364347#M44005</link>
    <description>&lt;P&gt;The &lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.0/SearchReference/Streamstats"&gt;streamstats&lt;/A&gt; command should do what you need here.&lt;/P&gt;

&lt;P&gt;Specifically, you'll want to use it with a &lt;CODE&gt;window=2&lt;/CODE&gt; and use the &lt;CODE&gt;first&lt;/CODE&gt; and &lt;CODE&gt;last&lt;/CODE&gt; stats function to pull out your times ( &lt;CODE&gt;_time&lt;/CODE&gt;) or values to create a duration. &lt;/P&gt;

&lt;P&gt;You'll want something like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... my search here ...
| streamstats window=2 first(_time) AS first_time, last(_time) AS last_time, first(&amp;lt;fieldname&amp;gt;) as first_val, last(&amp;lt;fieldname&amp;gt;) as last_val
| eval duration = first_time - last_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where you replace  with whatever gave you the field with values "A", "B", and so on.&lt;/P&gt;

&lt;P&gt;Here's a run-anywhere as an example.  In it I create a fake "nums" that I use - that's the first 4 lines.  You'll want to start with the streamstats right after you have your data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval nums="3 7 8 12 15 19" 
| makemv delim=" " nums 
| mvexpand nums 
| streamstats window=2 last(nums) AS oldest first(nums) AS newest 
| eval duration=oldest-newest
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The resulting output will hopefully be easily adaptable to your own needs.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Oct 2017 10:51:02 GMT</pubDate>
    <dc:creator>Richfez</dc:creator>
    <dc:date>2017-10-03T10:51:02Z</dc:date>
    <item>
      <title>Sankey Diagram - Custom Visualization: One event in multiple transactions</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Sankey-Diagram-Custom-Visualization-One-event-in-multiple/m-p/364346#M44004</link>
      <description>&lt;P&gt;I have events by this pattern:&lt;BR /&gt;
time id state&lt;/P&gt;

&lt;P&gt;e.g.:&lt;BR /&gt;
2017-03-10 10:30:00 123 A&lt;BR /&gt;
2017-03-10 10:30:01 123 B&lt;BR /&gt;
2017-03-10 10:30:02 123 C&lt;BR /&gt;
2017-03-10 10:30:03 123 D&lt;/P&gt;

&lt;P&gt;What i can get with "| transaction id"&lt;BR /&gt;
A B duration&lt;BR /&gt;
C D duration&lt;/P&gt;

&lt;P&gt;For Sankey diagram need to transform them into pattern&lt;/P&gt;

&lt;P&gt;e.g.:&lt;BR /&gt;
A B duration&lt;BR /&gt;
B C duration&lt;BR /&gt;
C D duration&lt;/P&gt;

&lt;P&gt;In shortcut I need one event to be in two transactions. Is there some trick to achieve this?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 10:07:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Sankey-Diagram-Custom-Visualization-One-event-in-multiple/m-p/364346#M44004</guid>
      <dc:creator>sosapes</dc:creator>
      <dc:date>2017-10-03T10:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Sankey Diagram - Custom Visualization: One event in multiple transactions</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Sankey-Diagram-Custom-Visualization-One-event-in-multiple/m-p/364347#M44005</link>
      <description>&lt;P&gt;The &lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.0/SearchReference/Streamstats"&gt;streamstats&lt;/A&gt; command should do what you need here.&lt;/P&gt;

&lt;P&gt;Specifically, you'll want to use it with a &lt;CODE&gt;window=2&lt;/CODE&gt; and use the &lt;CODE&gt;first&lt;/CODE&gt; and &lt;CODE&gt;last&lt;/CODE&gt; stats function to pull out your times ( &lt;CODE&gt;_time&lt;/CODE&gt;) or values to create a duration. &lt;/P&gt;

&lt;P&gt;You'll want something like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... my search here ...
| streamstats window=2 first(_time) AS first_time, last(_time) AS last_time, first(&amp;lt;fieldname&amp;gt;) as first_val, last(&amp;lt;fieldname&amp;gt;) as last_val
| eval duration = first_time - last_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where you replace  with whatever gave you the field with values "A", "B", and so on.&lt;/P&gt;

&lt;P&gt;Here's a run-anywhere as an example.  In it I create a fake "nums" that I use - that's the first 4 lines.  You'll want to start with the streamstats right after you have your data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval nums="3 7 8 12 15 19" 
| makemv delim=" " nums 
| mvexpand nums 
| streamstats window=2 last(nums) AS oldest first(nums) AS newest 
| eval duration=oldest-newest
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The resulting output will hopefully be easily adaptable to your own needs.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 10:51:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Sankey-Diagram-Custom-Visualization-One-event-in-multiple/m-p/364347#M44005</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2017-10-03T10:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Sankey Diagram - Custom Visualization: One event in multiple transactions</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Sankey-Diagram-Custom-Visualization-One-event-in-multiple/m-p/364348#M44006</link>
      <description>&lt;P&gt;Thank you it helped find me a way!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 15:35:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Sankey-Diagram-Custom-Visualization-One-event-in-multiple/m-p/364348#M44006</guid>
      <dc:creator>sosapes</dc:creator>
      <dc:date>2017-10-03T15:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Sankey Diagram - Custom Visualization: One event in multiple transactions</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Sankey-Diagram-Custom-Visualization-One-event-in-multiple/m-p/364349#M44007</link>
      <description>&lt;P&gt;Excellent!  &lt;/P&gt;

&lt;P&gt;It would be very useful to those who stumble across this answer later if you could provide the search you ended up with here and mark the question as accepted.&lt;/P&gt;

&lt;P&gt;Second best (and good enough) is just clicking "Accept" so everyone knows there's a valid answer!&lt;/P&gt;

&lt;P&gt;Thanks!  And glad we could help!&lt;/P&gt;

&lt;P&gt;-Rich&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 15:56:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Sankey-Diagram-Custom-Visualization-One-event-in-multiple/m-p/364349#M44007</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2017-10-03T15:56:42Z</dc:date>
    </item>
  </channel>
</rss>

