<?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: Add column with last logon user to the table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Add-column-with-last-logon-user-to-the-table/m-p/571368#M199105</link>
    <description>&lt;P&gt;The $ts$ token must exist and must be in a format that matches the values in the time field.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Oct 2021 15:58:34 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2021-10-18T15:58:34Z</dc:date>
    <item>
      <title>Add column with last logon user to the table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-column-with-last-logon-user-to-the-table/m-p/571323#M199090</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have following table:&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100.00000000000001%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;ts&amp;nbsp;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;action&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;file_name&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;source_ip&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;&lt;SPAN&gt;2021-10-12T09:34:08.910998Z&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;File Open&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;test&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;10.0.0.14&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to add to this table column with the last username who logged from this ip address, using as a latest filter timestamp from this event and as a earliest timestamp - 24h.&lt;/P&gt;&lt;P&gt;Search 1 on the dasboard:&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=files sourcetype=test_files | search src_ip="$src_ip$" action="$action$" file_name="$name_substr$" | table ts, action, &amp;nbsp;file_name, src_ip&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Search 2, that currently based on two tokens from the first table (ts and src_ip):&lt;/P&gt;&lt;P&gt;index="windows" EventCode=4624 src_ip="$ip$" | eval time="$ts$" | eval ts_u=strptime(time, "%Y-%m-%dT%H:%M:%S.%6NZ") | eval start=relative_time(ts_u,"-24h")&amp;nbsp; | where _time&amp;gt;$$start$$ AND _time&amp;lt;$$ts_u$$ | stats latest(_time) AS Latest, latest(TargetUserName) AS LastUser | eval LastEvent=strftime(Latest,"%+") | table LastEvent,LastUser&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to merge this two searches to one table, but if I use join or append command I can't use the ts/_time and src_ip field values from the first search (result is empty).&lt;/P&gt;&lt;P&gt;Do you have any idea how I can merge events from two independent sources?&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 12:07:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-column-with-last-logon-user-to-the-table/m-p/571323#M199090</guid>
      <dc:creator>raffal59</dc:creator>
      <dc:date>2021-10-18T12:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Add column with last logon user to the table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-column-with-last-logon-user-to-the-table/m-p/571334#M199097</link>
      <description>&lt;P&gt;It would help to know how to tried using the join and append commands.&lt;/P&gt;&lt;P&gt;Did you try something like this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=files sourcetype=test_files 
| search src_ip="$src_ip$" action="$action$" file_name="$name_substr$" 
| table ts, action,  file_name, src_ip
| append [ search index="windows" EventCode=4624 src_ip="$ip$" 
  | eval time="$ts$" 
  | eval ts_u=strptime(time, "%Y-%m-%dT%H:%M:%S.%6NZ") 
  | eval start=relative_time(ts_u,"-24h")  
  | where _time&amp;gt;$$start$$ AND _time&amp;lt;$$ts_u$$ 
  | stats latest(_time) AS Latest, latest(TargetUserName) AS LastUser by src_ip
  | eval LastEvent=strftime(Latest,"%+") 
  | table src_ip,LastEvent,LastUser ]
| stats values(*) as * by src_ip
| table ts, action, file_name, src_ip, LastEvent, LastUser&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 18 Oct 2021 13:14:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-column-with-last-logon-user-to-the-table/m-p/571334#M199097</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-10-18T13:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: Add column with last logon user to the table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-column-with-last-logon-user-to-the-table/m-p/571354#M199101</link>
      <description>&lt;P&gt;I tried do this with join command, but there is a problem with using field values (ts) in subsearch with event code.&lt;/P&gt;&lt;PRE&gt;index=files sourcetype=test_files&lt;BR /&gt;| search src_ip="$src_ip$" action="$action$" file_name="$name_substr$"&lt;BR /&gt;| join type=inner src_ip &lt;BR /&gt;[ search index="windows" EventCode=4624 src_ip="$src_ip$"&lt;BR /&gt;| eval time="$ts$" &lt;BR /&gt;| eval ts_u=strptime(time, "%Y-%m-%dT%H:%M:%S.%6NZ") &lt;BR /&gt;| eval start=relative_time(ts_u,"-24h")&lt;BR /&gt;| where _time&amp;gt;$$start$$ AND _time&amp;lt;$$ts_u$$ &lt;BR /&gt;| stats latest(_time) AS Latest, latest(TargetUserName) AS LastUser by src_ip &lt;BR /&gt;| eval LastEvent=strftime(Latest,"%+") &lt;BR /&gt;| table src_ip,LastEvent,LastUser ] &lt;BR /&gt;| table ts, action, file_name, src_ip, LastEvent, LastUser, name&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I specify example of time in subsearch it works correctly.&lt;/P&gt;&lt;PRE&gt;index=files sourcetype=test_files&lt;BR /&gt;| search src_ip="$src_ip$" action="$action$" file_name="$name_substr$"&lt;BR /&gt;| join type=inner src_ip &lt;BR /&gt;[ search index="windows" EventCode=4624 src_ip="$src_ip$"&lt;BR /&gt;| eval time="2021-08-12T01:48:10.327248Z" &lt;BR /&gt;| eval ts_u=strptime(time, "%Y-%m-%dT%H:%M:%S.%6NZ") &lt;BR /&gt;| eval start=relative_time(ts_u,"-24h")&lt;BR /&gt;| where _time&amp;gt;$$start$$ AND _time&amp;lt;$$ts_u$$ &lt;BR /&gt;| stats latest(_time) AS Latest, latest(TargetUserName) AS LastUser by src_ip &lt;BR /&gt;| eval LastEvent=strftime(Latest,"%+") &lt;BR /&gt;| table src_ip,LastEvent,LastUser ] &lt;BR /&gt;| table ts, action, file_name, src_ip, LastEvent, LastUser, name&lt;/PRE&gt;&lt;P&gt;Is there any workaround for this issue?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 15:02:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-column-with-last-logon-user-to-the-table/m-p/571354#M199101</guid>
      <dc:creator>raffal59</dc:creator>
      <dc:date>2021-10-18T15:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Add column with last logon user to the table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-column-with-last-logon-user-to-the-table/m-p/571368#M199105</link>
      <description>&lt;P&gt;The $ts$ token must exist and must be in a format that matches the values in the time field.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 15:58:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-column-with-last-logon-user-to-the-table/m-p/571368#M199105</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-10-18T15:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Add column with last logon user to the table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-column-with-last-logon-user-to-the-table/m-p/571521#M199153</link>
      <description>&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;Thank you for your help. Do you mean that there is no possibility to do table like this?&lt;/P&gt;&lt;TABLE border="1" width="110.20661089640103%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;&lt;SPAN&gt;ts&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;action&lt;/TD&gt;&lt;TD width="8.333333333333334%" height="25px"&gt;file_name&amp;nbsp;&lt;/TD&gt;&lt;TD width="8.333333333333334%"&gt;source_ip&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Last Logon User&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 14:34:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-column-with-last-logon-user-to-the-table/m-p/571521#M199153</guid>
      <dc:creator>raffal59</dc:creator>
      <dc:date>2021-10-19T14:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Add column with last logon user to the table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-column-with-last-logon-user-to-the-table/m-p/571551#M199165</link>
      <description>&lt;P&gt;Not saying that at all.&amp;nbsp; It may very well be possible, depending on the data.&amp;nbsp; The trick will be to get the token value to match what's in the index.&amp;nbsp; That probably will require an eval command, but I don't know enough about the data to offer specifics.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 19:40:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-column-with-last-logon-user-to-the-table/m-p/571551#M199165</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-10-19T19:40:14Z</dc:date>
    </item>
  </channel>
</rss>

