mail.log

mail.log

Rabin Yasharzadehe rabin at rabin.io
Mon Jan 17 12:27:56 IST 2022


journalctl can help you with that, e.g if you use postfix for MTA

# journalctl --no-hostname -o short-iso --since -24h -u postfix

2022-01-17T03:19:14+0000 postfix/pickup[932305]: D8D2E40FFC: uid=0
from=<root>
2022-01-17T03:19:14+0000 postfix/cleanup[932955]: D8D2E40FFC:
message-id=<20220117031914.D8D2E40FFC at mail.local>
2022-01-17T03:19:14+0000 postfix/qmgr[1458]: D8D2E40FFC:
from=<root at mail.local>, size=2916, nrcpt=1 (queue active)
2022-01-17T03:19:14+0000 postfix/local[932957]: D8D2E40FFC:
to=<root at mail.local>, orig_to=<root>, relay=local, delay=0.09,
delays=0.07/0.02/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
2022-01-17T03:19:14+0000 postfix/qmgr[1458]: D8D2E40FFC: removed

--
Rabin


‪On Mon, 17 Jan 2022 at 10:59, ‫אורי‬‎ <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?
>
> אורי
> uri at speedy.net
> _______________________________________________
> Linux-il mailing list
> Linux-il at cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20220117/8d5b47f3/attachment.html>


More information about the Linux-il mailing list