<?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 How to create multisearch with different transactions times and find a distinct average time for each transaction? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-multisearch-with-different-transactions-times-and/m-p/613454#M213207</link>
    <description>&lt;P&gt;Hello Friends,&lt;/P&gt;
&lt;P&gt;I have an interesting query that I would like help on.&lt;/P&gt;
&lt;P&gt;I have three transactions that we are tracking and I would like to create a graph that has the three transaction time categories and their averages.&lt;/P&gt;
&lt;P&gt;I am able to graph the three graphs together, and I can do their average individually, but I need help combining them together.&lt;/P&gt;
&lt;P&gt;My code to show all of the different graphs are:&lt;/P&gt;
&lt;P&gt;|multisearch&lt;BR /&gt;[search&lt;BR /&gt;(&lt;BR /&gt;index="a" addinventory InboundInventoryChangeElement&lt;BR /&gt;)&lt;BR /&gt;| eval addTime = if(actionelementname=="AddInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f") ,length)&lt;BR /&gt;|where addTime&amp;gt;0&lt;BR /&gt;]&lt;BR /&gt;[search&lt;BR /&gt;(&lt;BR /&gt;index="a" SWAPinventory InboundInventoryChangeElement&lt;BR /&gt;)&lt;BR /&gt;| eval swapTime = if(actionelementname=="SwapInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f") ,length)&lt;BR /&gt;|where swapTime&amp;gt;0&lt;BR /&gt;]&lt;BR /&gt;[search&lt;BR /&gt;(&lt;BR /&gt;index="a" removeinventory InboundInventoryChangeElement&lt;BR /&gt;)&lt;BR /&gt;| eval removeTime = if(actionelementname=="RemoveInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f") ,length)&lt;BR /&gt;|where removeTime&amp;gt;0&lt;BR /&gt;]&lt;BR /&gt;|table _time, addTime, swapTime, removeTime&lt;/P&gt;
&lt;P&gt;And here is my search for the averages.&lt;/P&gt;
&lt;P&gt;index="a" addinventory InboundInventoryChangeElement | eval addTime = strftime(strptime( length,"%H:%M:%S.%f"),"%S.%f")&lt;BR /&gt;|where addTime&amp;gt;0| table _time, addTime&lt;BR /&gt;| join [ search index="a" addinventory InboundInventoryChangeElement&lt;BR /&gt;| eval addTime = strftime(strptime( length,"%H:%M:%S.%f"),"%S.%f")&lt;BR /&gt;|where addTime&amp;gt;0&lt;BR /&gt;|stats avg(addTime) as AverageAddTime]&lt;/P&gt;
&lt;P&gt;The other two searches are the exact same except it the variables are different for the add, swap, and remove.&lt;/P&gt;
&lt;P&gt;Any help would be greatly appreciated!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if there is an easier way rather than joins and multisearches, please let me know!&lt;/P&gt;
&lt;P&gt;Thank you!!!&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2022 17:53:27 GMT</pubDate>
    <dc:creator>amaralt808</dc:creator>
    <dc:date>2022-09-16T17:53:27Z</dc:date>
    <item>
      <title>How to create multisearch with different transactions times and find a distinct average time for each transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-multisearch-with-different-transactions-times-and/m-p/613454#M213207</link>
      <description>&lt;P&gt;Hello Friends,&lt;/P&gt;
&lt;P&gt;I have an interesting query that I would like help on.&lt;/P&gt;
&lt;P&gt;I have three transactions that we are tracking and I would like to create a graph that has the three transaction time categories and their averages.&lt;/P&gt;
&lt;P&gt;I am able to graph the three graphs together, and I can do their average individually, but I need help combining them together.&lt;/P&gt;
&lt;P&gt;My code to show all of the different graphs are:&lt;/P&gt;
&lt;P&gt;|multisearch&lt;BR /&gt;[search&lt;BR /&gt;(&lt;BR /&gt;index="a" addinventory InboundInventoryChangeElement&lt;BR /&gt;)&lt;BR /&gt;| eval addTime = if(actionelementname=="AddInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f") ,length)&lt;BR /&gt;|where addTime&amp;gt;0&lt;BR /&gt;]&lt;BR /&gt;[search&lt;BR /&gt;(&lt;BR /&gt;index="a" SWAPinventory InboundInventoryChangeElement&lt;BR /&gt;)&lt;BR /&gt;| eval swapTime = if(actionelementname=="SwapInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f") ,length)&lt;BR /&gt;|where swapTime&amp;gt;0&lt;BR /&gt;]&lt;BR /&gt;[search&lt;BR /&gt;(&lt;BR /&gt;index="a" removeinventory InboundInventoryChangeElement&lt;BR /&gt;)&lt;BR /&gt;| eval removeTime = if(actionelementname=="RemoveInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f") ,length)&lt;BR /&gt;|where removeTime&amp;gt;0&lt;BR /&gt;]&lt;BR /&gt;|table _time, addTime, swapTime, removeTime&lt;/P&gt;
&lt;P&gt;And here is my search for the averages.&lt;/P&gt;
&lt;P&gt;index="a" addinventory InboundInventoryChangeElement | eval addTime = strftime(strptime( length,"%H:%M:%S.%f"),"%S.%f")&lt;BR /&gt;|where addTime&amp;gt;0| table _time, addTime&lt;BR /&gt;| join [ search index="a" addinventory InboundInventoryChangeElement&lt;BR /&gt;| eval addTime = strftime(strptime( length,"%H:%M:%S.%f"),"%S.%f")&lt;BR /&gt;|where addTime&amp;gt;0&lt;BR /&gt;|stats avg(addTime) as AverageAddTime]&lt;/P&gt;
&lt;P&gt;The other two searches are the exact same except it the variables are different for the add, swap, and remove.&lt;/P&gt;
&lt;P&gt;Any help would be greatly appreciated!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if there is an easier way rather than joins and multisearches, please let me know!&lt;/P&gt;
&lt;P&gt;Thank you!!!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 17:53:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-multisearch-with-different-transactions-times-and/m-p/613454#M213207</guid>
      <dc:creator>amaralt808</dc:creator>
      <dc:date>2022-09-16T17:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to create multisearch with different transactions times and find a distinct average time for each transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-multisearch-with-different-transactions-times-and/m-p/613457#M213209</link>
      <description>&lt;P&gt;I think you can do that in a single query.&amp;nbsp; No need for &lt;FONT face="courier new,courier"&gt;multisearch&lt;/FONT&gt;.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="a" (addinventory OR SWAPinventory OR removeinventory ) InboundInventoryChangeElement
| eval addTime = if(actionelementname=="AddInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f"), null())
| eval swapTime = if(actionelementname=="SwapInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f"), null())
| eval removeTime = if(actionelementname=="RemoveInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f"), null())
| where (isnotnull(addTime) OR isnotnull(swapTime) OR isnotnull(removeTime))
| fields _time, addTime, swapTime, removeTime
| stats avg(addTime) as AverageAddTime, avg(swapTime) as AverageSwapTime, avg(removeTime) as AverageRemoveTime&lt;/LI-CODE&gt;&lt;P&gt;I used nulls rather than zeroes for missing values so they're not included in the averages.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 18:30:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-multisearch-with-different-transactions-times-and/m-p/613457#M213209</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-09-16T18:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create multisearch with different transactions times and find a distinct average time for each transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-multisearch-with-different-transactions-times-and/m-p/613459#M213211</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much!!&lt;/P&gt;&lt;P&gt;I was able to implement your solution as a join. This is a problem that I ran into with splunk previously where if you do a stats avg then it collapses your original field into nothing and only shows the average. I was able to do a join and it works now!&lt;/P&gt;&lt;P&gt;For reference here is the solution that works:&lt;/P&gt;&lt;P&gt;index="a" (addinventory OR SWAPinventory OR removeinventory ) InboundInventoryChangeElement&lt;BR /&gt;| eval addTime = if(actionelementname=="AddInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f"), null())&lt;BR /&gt;| eval swapTime = if(actionelementname=="SwapInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f"), null())&lt;BR /&gt;| eval removeTime = if(actionelementname=="RemoveInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f"), null())&lt;BR /&gt;| where (isnotnull(addTime) OR isnotnull(swapTime) OR isnotnull(removeTime))&lt;BR /&gt;| table _time, addTime, swapTime, removeTime&lt;BR /&gt;| join[ search index="a" (addinventory OR SWAPinventory OR removeinventory ) InboundInventoryChangeElement&lt;BR /&gt;| eval addTime = if(actionelementname=="AddInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f"), null())&lt;BR /&gt;| eval swapTime = if(actionelementname=="SwapInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f"), null())&lt;BR /&gt;| eval removeTime = if(actionelementname=="RemoveInventory",strftime(strptime(length,"%H:%M:%S.%f"),"%S.%f"), null())&lt;BR /&gt;| stats avg(addTime) as AverageAddTime, avg(swapTime) as AverageSwapTime, avg(removeTime) as AverageRemoveTime&lt;BR /&gt;]&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 18:45:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-multisearch-with-different-transactions-times-and/m-p/613459#M213211</guid>
      <dc:creator>amaralt808</dc:creator>
      <dc:date>2022-09-16T18:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create multisearch with different transactions times and find a distinct average time for each transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-multisearch-with-different-transactions-times-and/m-p/613460#M213212</link>
      <description>&lt;P&gt;If you need to preserve other fields then use &lt;FONT face="courier new,courier"&gt;eventstats&lt;/FONT&gt; instead of &lt;FONT face="courier new,courier"&gt;stats&lt;/FONT&gt;.&amp;nbsp; Try to avoid joins because they don't perform well and have limits.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 18:48:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-multisearch-with-different-transactions-times-and/m-p/613460#M213212</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-09-16T18:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to create multisearch with different transactions times and find a distinct average time for each transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-multisearch-with-different-transactions-times-and/m-p/613463#M213213</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had no idea! When i used Eventstats it worked beautifully without the join. Thank you from the bottom of my heart!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 18:59:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-multisearch-with-different-transactions-times-and/m-p/613463#M213213</guid>
      <dc:creator>amaralt808</dc:creator>
      <dc:date>2022-09-16T18:59:05Z</dc:date>
    </item>
  </channel>
</rss>

