mail.log

mail.log

shimi linux-il at shimi.net
Mon Jan 17 11:19:10 IST 2022


‪On Mon, Jan 17, 2022 at 10:58 AM ‫אורי‬‎ <uri at speedy.net> wrote:‬

> Hi,
>
> I want to check mail.log for how many emails are sent every day. The
> format of my mail.log is something like this:
>
> Jan 17 08:49:23 www .... (the rest of the log)
>
> I'm running a command such as:
>
> cat mail.log* |fgrep "status=sent (250 Ok"|awk '{print $1" "$2}'|sort
> -n|uniq -c
>
> And I receive the number of emails sent every day. But the date doesn't
> contain the year, the months are sorted alphabetically and the line of Jan
> 17 comes before the line of Jan 2. I would like to sort the lines according
> to the date order such as in yyyy-mm-dd and with including the year. How do
> I do it?
>
>
If the format is broken, why not fix the format itself, at the source?

https://serverfault.com/questions/967286/how-to-change-the-date-format-of-maillog

HTH,

-- Shimi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20220117/5aa99bfe/attachment.html>


More information about the Linux-il mailing list