Tuples - finding last line in files that end in mm-dd-yyyy.log

Please help. I’m trying to display the last line of the newest log file in a directory. The log files end in the date. This is what I have come up with to get the last line of the file but how do I tell it to look in the newest log file?

items 1 of (item 1 of it, (lines of item 0 of it)) whose ((line number of item 1 of it) > (item 0 of it -1)) of (it, number of lines of it) of file “C:\ProgramData\PSS\EventLogs\“EventLog_mm-dd-yyyy.log”

You can dynamically generate the file name so it reflects today’s date.

Q: "EventLog_" & (((month of it as two digits) & "-" & (day_of_month of it as two digits) & "-" & year of it as string) of date ("GMT" as time zone) of now) & ".log"
A: EventLog_07-01-2020.log

To then find files matching this in a folder

Q: files whose (name of it is "EventLog_" & (((month of it as two digits) & "-" & (day_of_month of it as two digits) & "-" & year of it as string) of date ("GMT" as time zone) of now) & ".log") of folders "C:\ProgramData\PSS\EventLogs"

Then precede that with your relevance to to pull your lines, see if this works for you

Q: items 1 of (item 1 of it, (lines of item 0 of it)) whose ((line number of item 1 of it) > (item 0 of it -1)) of (it, number of lines of it) of files whose (name of it is "EventLog_" & (((month of it as two digits) & "-" & (day_of_month of it as two digits) & "-" & year of it as string) of date ("GMT" as time zone) of now) & ".log") of folders "C:\ProgramData\PSS\EventLogs"

2 Likes

@SLB on fire today with relevance assistance in the forum!

1 Like

That works perfectly. Thanks!!