<?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: Transaction not showing me Unique Users in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Transaction-not-showing-me-Unique-Users/m-p/745692#M241521</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/171882"&gt;@Crabbok&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You shouldnt need to specify a hard-coded list of users, that was just me creating some test data. Assuming the Message field is available to run the regex you should just be able to do:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=Message "has (?&amp;lt;action&amp;gt;[a-zA-Z]+) the event session" 
| eval {action}_time=_time 
| sort UserXXID 
| streamstats count as userEventNum min(joined_time) as session_joined_time, max(left_time) as session_left_time by UserXXID reset_after="action=\"left\""
| eval action_time=strptime(_time, "%Y-%m-%d %H:%M:%S")
| stats range(action_time) as sessionDurationSeconds, values(action) as actions, max(_time) as session_left_time by UserXXID session_joined_time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;If UserXXID is not a field then you can use rex to get this too.&lt;/P&gt;&lt;P&gt;If you want to stick to using transactions, try adding *&lt;SPAN&gt;keepevicted=true* to your transaction command as I think this might keep the non-completed transaction events.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;See&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Transaction#:~:text=Syntax%3A%20keepevicted%3D%3Cbool%3E" target="_blank"&gt;https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Transaction#:~:text=Syntax%3A%20keepevicted%3D%3Cbool%3E&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
    <pubDate>Wed, 07 May 2025 13:37:40 GMT</pubDate>
    <dc:creator>livehybrid</dc:creator>
    <dc:date>2025-05-07T13:37:40Z</dc:date>
    <item>
      <title>Transaction not showing me Unique Users</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-not-showing-me-Unique-Users/m-p/745589#M241499</link>
      <description>&lt;P&gt;I'm trying to track the duration of user sessions to a server.&amp;nbsp; &amp;nbsp;I want to know WHICH users are connecting, and for how long each session is.&amp;nbsp; &amp;nbsp;The problem is, with multiple users, I'm having nested transactions happen , where USER001 joins, but USER004 Leaves, and that creates an event.&amp;nbsp; &amp;nbsp;I want it to ONLY look at only scenarios in which the same user that Joins, Leaves.&amp;nbsp; &amp;nbsp;I can't seem to get it to do this.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Eventcode=44&amp;nbsp; is the event code for these particular events I want to track&lt;BR /&gt;UserXXID is a Field Extraction I've built to show each userID, as it is not a standard username that Splunk automatically understood.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;The two primary types of logs I'm looking for is when they've "joined" or "left" the event.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here is the command I'm using -&amp;nbsp;&lt;BR /&gt;host="XXComputer04" EventCode=44 | transaction startswith="joined" endswith="left"&lt;BR /&gt;|eval Hours=duration/3600&lt;BR /&gt;|timechart count by UserXXID&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample of the log entry I'm trying to parse.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;LogName=Application&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;EventCode=120&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;EventType=44&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;ComputerName=XXcomputer004&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;SourceName=EventXService&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Type=Information&lt;/SPAN&gt; &lt;SPAN class=""&gt;RecordNumber=1234427&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Keywords=Classic&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;TaskCategory=State&lt;/SPAN&gt; &lt;SPAN class=""&gt;Transition&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;OpCode=Info&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Message=&lt;/SPAN&gt;&lt;SPAN&gt; [0x0x]&lt;/SPAN&gt;&lt;SPAN class=""&gt;::ProcessLeave&lt;/SPAN&gt;&lt;SPAN&gt;() &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;xxUSER002xx&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;left&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;event33001&lt;BR /&gt;&lt;BR /&gt;---------&lt;BR /&gt;&lt;BR /&gt;I have also tried simply - |transaction USERXXID to keep unique userID's together - and while that works, it then somehow ignores ALL "left event" messages and only shows "joined" for any given user.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Any help would be appreciated!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 May 2025 19:33:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-not-showing-me-Unique-Users/m-p/745589#M241499</guid>
      <dc:creator>Crabbok</dc:creator>
      <dc:date>2025-05-06T19:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction not showing me Unique Users</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-not-showing-me-Unique-Users/m-p/745599#M241500</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/171882"&gt;@Crabbok&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check out the following - I think this should solve your usecase here, note that I have avoided transaction because its a pretty terrible command to use - I'd only recommend it if you absolutely have to! Instead we can leverage stats.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ive applied some further logic here to split events into individual sessions, so that if a user joins and leaves multiple times in the search window then it will show multiple sessions - see the example below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="livehybrid_0-1746567662064.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/38880i1F5D412D48A2A5DB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="livehybrid_0-1746567662064.png" alt="livehybrid_0-1746567662064.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The full SPL for this for you to try is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="Message,UserXXID,_time
Info: User USER001 has joined the event session.,USER001,2025-05-06 22:20:03
Info: User USER002 has joined the event session.,USER002,2025-05-06 22:21:43
Info: User USER001 has left the event session.,USER001,2025-05-06 22:36:43
Info: User USER003 has joined the event session.,USER003,2025-05-06 22:40:03
Info: User USER002 has left the event session.,USER002,2025-05-06 22:53:23
Info: User USER003 has left the event session.,USER003,2025-05-06 23:01:43
Info: User USER001 has joined the event session.,USER001,2025-05-06 23:18:23" 
| rex field=Message "has (?&amp;lt;action&amp;gt;[a-zA-Z]+) the event session" 
| eval {action}_time=_time 
| sort UserXXID 
| streamstats count as userEventNum min(joined_time) as session_joined_time, max(left_time) as session_left_time by UserXXID reset_after="action=\"left\""
| eval action_time=strptime(_time, "%Y-%m-%d %H:%M:%S")
| stats range(action_time) as sessionDurationSeconds, values(action) as actions, max(_time) as session_left_time by UserXXID session_joined_time&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
      <pubDate>Tue, 06 May 2025 21:41:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-not-showing-me-Unique-Users/m-p/745599#M241500</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-05-06T21:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction not showing me Unique Users</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-not-showing-me-Unique-Users/m-p/745688#M241517</link>
      <description>&lt;P&gt;Thank you for the quick response!&amp;nbsp; &amp;nbsp;This looks like a great solution - however the reason I was using transaction is because we have new users all the time and I can't pre-add every possible username.&amp;nbsp; &amp;nbsp; I know people say that transaction is awful but for the life of me I've never had a single problem using it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 May 2025 12:40:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-not-showing-me-Unique-Users/m-p/745688#M241517</guid>
      <dc:creator>Crabbok</dc:creator>
      <dc:date>2025-05-07T12:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction not showing me Unique Users</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-not-showing-me-Unique-Users/m-p/745692#M241521</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/171882"&gt;@Crabbok&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You shouldnt need to specify a hard-coded list of users, that was just me creating some test data. Assuming the Message field is available to run the regex you should just be able to do:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=Message "has (?&amp;lt;action&amp;gt;[a-zA-Z]+) the event session" 
| eval {action}_time=_time 
| sort UserXXID 
| streamstats count as userEventNum min(joined_time) as session_joined_time, max(left_time) as session_left_time by UserXXID reset_after="action=\"left\""
| eval action_time=strptime(_time, "%Y-%m-%d %H:%M:%S")
| stats range(action_time) as sessionDurationSeconds, values(action) as actions, max(_time) as session_left_time by UserXXID session_joined_time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;If UserXXID is not a field then you can use rex to get this too.&lt;/P&gt;&lt;P&gt;If you want to stick to using transactions, try adding *&lt;SPAN&gt;keepevicted=true* to your transaction command as I think this might keep the non-completed transaction events.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;See&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Transaction#:~:text=Syntax%3A%20keepevicted%3D%3Cbool%3E" target="_blank"&gt;https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Transaction#:~:text=Syntax%3A%20keepevicted%3D%3Cbool%3E&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
      <pubDate>Wed, 07 May 2025 13:37:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-not-showing-me-Unique-Users/m-p/745692#M241521</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-05-07T13:37:40Z</dc:date>
    </item>
  </channel>
</rss>

