I am writing a relevance to fetch failed keyword from BESClient logfile.
Out of the single/multiple “failed” entries I want to capture the last/latest entry of “failed” keyword in the logfile and convert the output to:
Day, DD MM YYYY <Time> <TimeZone>
I have tried the below relevance. But it gives "E: A singular expression is required." error:
q: ((day_of_month (first 2 of following text of position 6 of it as integer) & month (first 2 of following text of position 4 of it as integer) & year (first 4 of it as integer)) of (names of file whose (name of it starts with "2" AND content of it as lowercase contains "failed") of folders "C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\__Global\Logs") as trimmed string) & " " & (preceding texts of lasts "-" of (following texts of firsts "At" of ((previous lines of it) of (lines whose (it contains "failed") of file whose (name of it starts with "2" AND content of it as lowercase contains "failed") of folders "C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\__Global\Logs")) as trimmed string))
E: A singular expression is required.
concatenation only works on single strings. You have a plural in there. (also, today’s log might be locked for reading, so you might want to use Locked Lines of File)
try:
q: following text of last "|" of concatenation "|" of ((last 2 of first 8 of item 0 of it & " " & last 2 of first 6 of item 0 of it & " " & first 4 of item 0 of it & " " & item 1 of it) | "something wrong") of (name of it, (it as trimmed string) of preceding texts of lasts "-" of following texts of firsts "At " of (previous lines of locked lines whose (it as lowercase contains "failed") of it)) of files whose ((name of it starts with "2") and (content of it as lowercase contains "failed") ) of folders "__Global\Logs" of data folder of client
A: 28 07 2021 22:48:51 -0400
q: number of files whose ((name of it starts with "2") and (content of it as lowercase contains "failed") ) of folders "__Global\Logs" of data folders of clients