<?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: Splunk Query for Search Query/Alert in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Query-for-Search-Query-Alert/m-p/509951#M2699</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/185959"&gt;@phanichintha&lt;/a&gt;&amp;nbsp;here is an example of how it can be achieved using the transaction command.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw = "time, userID, eventName
20/07/2020 09:00:00, 1, AM-LOGIN-COMPLETED
20/07/2020 09:01:00, 2, AM-LOGIN-COMPLETED
20/07/2020 09:10:00, 2, AM-LOGOUT
20/07/2020 09:06:00, 1, AM-LOGOUT
20/07/2020 09:00:00, 3, AM-LOGIN-COMPLETED
20/07/2020 10:06:00, 3, AM-LOGOUT"
| multikv forceheader=1
| eval _time = strptime(time,"%d/%m/%Y %H:%M:%S")
| transaction userID maxspan=1d
| stats avg(duration) as AverageTimeSpentOnThePlatform&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the link to the command&amp;nbsp;&lt;BR /&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transaction" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transaction&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can make it more robust by using the startswith and endwith arguments&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jul 2020 05:12:57 GMT</pubDate>
    <dc:creator>anmolpatel</dc:creator>
    <dc:date>2020-07-20T05:12:57Z</dc:date>
    <item>
      <title>Splunk Query for Search Query/Alert</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Query-for-Search-Query-Alert/m-p/509942#M2698</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need Avg time spent on login and logout by the user and want to calculate from the time they logged in and then out and then the total to show.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;Need a query for this:&amp;nbsp;&lt;/STRONG&gt;Average time spent on the Platform by Users?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example: &lt;/STRONG&gt;each user spent how much time on work per day.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Query:&lt;BR /&gt;&lt;/STRONG&gt;sourcetype="%forge%" source="/home/amadmin/log/authentication.audit.json" eventName=AM-LOGIN-COMPLETED OR eventName=AM-LOGOUT userId=*&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 03:03:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Query-for-Search-Query-Alert/m-p/509942#M2698</guid>
      <dc:creator>phanichintha</dc:creator>
      <dc:date>2020-07-20T03:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query for Search Query/Alert</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Query-for-Search-Query-Alert/m-p/509951#M2699</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/185959"&gt;@phanichintha&lt;/a&gt;&amp;nbsp;here is an example of how it can be achieved using the transaction command.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw = "time, userID, eventName
20/07/2020 09:00:00, 1, AM-LOGIN-COMPLETED
20/07/2020 09:01:00, 2, AM-LOGIN-COMPLETED
20/07/2020 09:10:00, 2, AM-LOGOUT
20/07/2020 09:06:00, 1, AM-LOGOUT
20/07/2020 09:00:00, 3, AM-LOGIN-COMPLETED
20/07/2020 10:06:00, 3, AM-LOGOUT"
| multikv forceheader=1
| eval _time = strptime(time,"%d/%m/%Y %H:%M:%S")
| transaction userID maxspan=1d
| stats avg(duration) as AverageTimeSpentOnThePlatform&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the link to the command&amp;nbsp;&lt;BR /&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transaction" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transaction&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can make it more robust by using the startswith and endwith arguments&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 05:12:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Query-for-Search-Query-Alert/m-p/509951#M2699</guid>
      <dc:creator>anmolpatel</dc:creator>
      <dc:date>2020-07-20T05:12:57Z</dc:date>
    </item>
  </channel>
</rss>

