<?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: group threefields and get the latest timestamp record and retrieve additional column value corresponding to that gro in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685756#M233971</link>
    <description>&lt;P&gt;Got it remediated by including&amp;nbsp;gcusello suggestion of | eval latestDeployed_version=Deployed_Data_time."|".version and used that&amp;nbsp; field in your stats statement as max value instead of latest. This worked well and validated to be fine. Thanks a lot to both&lt;/P&gt;</description>
    <pubDate>Mon, 29 Apr 2024 01:43:29 GMT</pubDate>
    <dc:creator>NathanAsh</dc:creator>
    <dc:date>2024-04-29T01:43:29Z</dc:date>
    <item>
      <title>group threefields and get the latest timestamp record and retrieve additional column value corresponding to that group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685695#M233958</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have a vast data set with a sample as below. Need to group the data based on three columns latest timestamp data and get the fourth column value against the latest timestamp found for that grouped data.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;Deployed_Data_time&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;env&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;app&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;version&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;4/16/2024 15:29&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;axe1&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;app1&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;v-228&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;4/16/2024 15:29&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;axe1&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;app1&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;v-228&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;9/15/2023 8:12&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;axe1&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;app1&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;v-131&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;9/15/2023 8:05&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;axe2&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;app1&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;v-120&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;9/12/2023 1:19&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;axe2&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;app1&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&amp;nbsp;v-128&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;4/16/2024 15:29&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;axe2&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;app2&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;v-628&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;4/16/2024 15:26&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;axe2&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;app2&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;v-626&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;9/15/2023 8:12&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;axe2&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;app2&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;v-531&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;9/15/2023 8:05&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;axe1&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;app2&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;v-530&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;9/12/2023 1:19&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;axe1&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;app2&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&amp;nbsp;v-528&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I need the output as&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="56.25%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;app&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;axe1&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;axe2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;app1&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;v-228&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;v-120&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;app2&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;v-530&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;P&gt;v-628&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I tried something as below but output is not as expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=*.log   source=*Report* | eval latestDeployed_version=Deployed_Data_time."|".version | eval latestVersion=Deployed_Data_time."|".version | stats latest(Deployed_Data_time) AS Deployed_Data_time values(env) AS env 
max(latestVersion) AS latestVersion BY app | rex field=latestVersion "[\|]+(?&amp;lt;version&amp;gt;.*)" | table app,version,env | chart values(version) by app, env limit=0
| fillnull value="Not Deployed" &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Please help me achieve this .&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2024 03:33:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685695#M233958</guid>
      <dc:creator>NathanAsh</dc:creator>
      <dc:date>2024-04-27T03:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: group threefields and get the latest timestamp record and retrieve additional column value corresponding to that gro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685697#M233959</link>
      <description>&lt;P&gt;This won't work as you want&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats latest(Deployed_Data_time) AS Deployed_Data_time values(env) AS env max(latestVersion) AS latestVersion BY app&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;latest() function is based on the _time field, so if you want Deployed_Data_time to be _time then you need to evaluate it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval _time=strptime(Deployed_Data_time,"%m/%d/%Y %H:%M")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but you also cannot do max(latestVersion) as that is simply doing a numeric comparison on the date, which is a string, so 4/16/2024 is LESS than 9/15/2023 - 4 is less than 9.&lt;/P&gt;&lt;P&gt;If you ever want to do string based date comparisons,&amp;nbsp; you need them to be ISO8601, i.e. YYYY-MM-DD-HH:MM:SS&lt;/P&gt;&lt;P&gt;So, using your example data, is this what you want?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="Deployed_Data_time,env,app,version
4/16/2024 15:29,axe1,app1,v-228
4/16/2024 15:29,axe1,app1,v-228
9/15/2023 8:12,axe1,app1,v-131
9/15/2023 8:05,axe2,app1,v-120
9/12/2023 1:19,axe2,app1, v-128
4/16/2024 15:29,axe2,app2,v-628
4/16/2024 15:26,axe2,app2,v-626
9/15/2023 8:12,axe2,app2,v-531
9/15/2023 8:05,axe1,app2,v-530
9/12/2023 1:19,axe1,app2, v-528"

| rex field=version "v-(?&amp;lt;v&amp;gt;\d+)"
| stats max(v) AS version BY app env
| table app,version,env 
| chart values(version) by app, env limit=0
| fillnull value="Not Deployed"&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 27 Apr 2024 04:06:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685697#M233959</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-04-27T04:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: group threefields and get the latest timestamp record and retrieve additional column value corresponding to that gro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685698#M233960</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258668"&gt;@NathanAsh&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;did you tried the OVER clause in the chart command?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=*.log   source=*Report* 
| eval latestDeployed_version=Deployed_Data_time."|".version 
| eval latestVersion=Deployed_Data_time."|".version 
| stats 
	latest(Deployed_Data_time) AS Deployed_Data_time 
	values(env) AS env 
	max(latestVersion) AS latestVersion 
	BY app 
| rex field=latestVersion "[\|]+(?&amp;lt;version&amp;gt;.*)" 
| table app version env 
| chart values(version) OVER app BY env limit=0
| fillnull value="Not Deployed" &lt;/LI-CODE&gt;&lt;P&gt;for more infos see at &lt;A href="https://docs.splunk.com/Documentation/Splunk/9.2.1/SearchReference/Chart" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.2.1/SearchReference/Chart&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2024 05:25:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685698#M233960</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-04-27T05:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: group threefields and get the latest timestamp record and retrieve additional column value corresponding to that gro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685708#M233964</link>
      <description>&lt;P&gt;No results displayed, but table returns the&amp;nbsp; same value as my try&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2024 11:29:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685708#M233964</guid>
      <dc:creator>NathanAsh</dc:creator>
      <dc:date>2024-04-27T11:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: group threefields and get the latest timestamp record and retrieve additional column value corresponding to that gro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685709#M233965</link>
      <description>&lt;P&gt;No , app1 in axe2 value should be&amp;nbsp;&lt;SPAN&gt;120 not 128, (latest deployed version as per the date timestamp)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2024 11:34:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685709#M233965</guid>
      <dc:creator>NathanAsh</dc:creator>
      <dc:date>2024-04-27T11:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: group threefields and get the latest timestamp record and retrieve additional column value corresponding to that gro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685710#M233966</link>
      <description>&lt;P&gt;Sorry, displays data but output is same as my try earlier, latest version is displayed along all env, not specific to that env is displayed.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2024 12:07:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685710#M233966</guid>
      <dc:creator>NathanAsh</dc:creator>
      <dc:date>2024-04-27T12:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: group threefields and get the latest timestamp record and retrieve additional column value corresponding to that gro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685742#M233968</link>
      <description>&lt;P&gt;anything in that line of thoughts be helpful to achieve this &lt;A href="https://community.splunk.com/t5/Splunk-Search/How-to-convert-rows-to-columns/m-p/398009" target="_self"&gt;https://community.splunk.com/t5/Splunk-Search/How-to-convert-rows-to-columns/m-p/398009&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Apr 2024 18:26:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685742#M233968</guid>
      <dc:creator>NathanAsh</dc:creator>
      <dc:date>2024-04-28T18:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: group threefields and get the latest timestamp record and retrieve additional column value corresponding to that gro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685749#M233969</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258668"&gt;@NathanAsh&lt;/a&gt;&amp;nbsp;You're right! Then use the strptime() example I mentioned and the latest() function. You don't seem to need _time so just convert Deployed_data_time to _time and you can use latest(version)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="Deployed_Data_time,env,app,version
4/16/2024 15:29,axe1,app1,v-228
4/16/2024 15:29,axe1,app1,v-228
9/15/2023 8:12,axe1,app1,v-131
9/15/2023 8:05,axe2,app1,v-120
9/12/2023 1:19,axe2,app1, v-128
4/16/2024 15:29,axe2,app2,v-628
4/16/2024 15:26,axe2,app2,v-626
9/15/2023 8:12,axe2,app2,v-531
9/15/2023 8:05,axe1,app2,v-530
9/12/2023 1:19,axe1,app2, v-528"

| eval _time=strptime(Deployed_Data_time, "%m/%d/%Y %H:%M")
| stats latest(version) AS version BY app env
| table app,version,env 
| chart values(version) by app, env limit=0
| fillnull value="Not Deployed"&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 28 Apr 2024 23:47:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685749#M233969</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-04-28T23:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: group threefields and get the latest timestamp record and retrieve additional column value corresponding to that gro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685755#M233970</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, it works for the sample data which I have given, but the actual data I pushed in splunk is not as per the Deployed date timestamp, I have pushed old data (2023 year) lately and new data (2024 ) first. Hence for some columns the results are coming as per the data pushed in to splunk time. Any work around can be applied?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2024 00:48:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685755#M233970</guid>
      <dc:creator>NathanAsh</dc:creator>
      <dc:date>2024-04-29T00:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: group threefields and get the latest timestamp record and retrieve additional column value corresponding to that gro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685756#M233971</link>
      <description>&lt;P&gt;Got it remediated by including&amp;nbsp;gcusello suggestion of | eval latestDeployed_version=Deployed_Data_time."|".version and used that&amp;nbsp; field in your stats statement as max value instead of latest. This worked well and validated to be fine. Thanks a lot to both&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2024 01:43:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685756#M233971</guid>
      <dc:creator>NathanAsh</dc:creator>
      <dc:date>2024-04-29T01:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: group threefields and get the latest timestamp record and retrieve additional column value corresponding to that gro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685757#M233972</link>
      <description>&lt;P&gt;Mmm, that's odd because I use that technique to manipulate _time - If you could find a simple example of _raw data where that is the case - perhaps by limiting the search just to pick up an event of each type - I'd be really interested to see.&lt;/P&gt;&lt;P&gt;If the date format for the 2023 data is not as per the &lt;STRONG&gt;strptime&lt;/STRONG&gt; format syntax that would cause a problem as it would be later - that would be my suspicion.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you can do a simple search for that 2023 data and do this&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval orig_time=strftime(_time, "%F %T.%Q")
| eval _time=strptime(...)
| table _time orig_time&lt;/LI-CODE&gt;&lt;P&gt;that may show the difference&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2024 01:44:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/group-threefields-and-get-the-latest-timestamp-record-and/m-p/685757#M233972</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-04-29T01:44:52Z</dc:date>
    </item>
  </channel>
</rss>

