I am trying to sort a log file in chronological order to identify which ones did not process and still have an old (probably yesterday's) date. This is a sample of the file:
I am trying to use "-M" to sort the months in order, but a command of
sort + 8 -9 -M +4 +5
doesn't appear to do anything and leaving "-M" out works except the months are in alphabetical order (Apr, Aug, Dec, etc.).
The output would be piped into a head command where the top line(s) may show a problem. What am I missing?
Assuming that your sort utility has a -M option (which is not required in standard sort utilities), you might want to try the following:
sort -k9,9n -k5,5M -k6,6n -k7,7
to perform a numeric sort on the year, a month sort on the abbreviated month, a numeric sort on the day, and a string sort on the time. This should sort by increased timestamps except during the shift from daylight saving time to standard time where the date sort should be correct, but the timestamp sort within those dates might be wrong for two hours on those days.
Those log records are not created locally. If a procedure runs to completion, it over writes that record and the log files (actually one record each) should be sent to us. If the first record of a concatenated sorted log file is about 24 hours or more earlier than the second one, we have a problem.