Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 267384

Summary: app-admin/mcelog enhancement: add date and time to logged exceptions
Product: Gentoo Linux Reporter: Denilson Sá Maia <denilsonsa>
Component: Current packagesAssignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed>
Status: RESOLVED FIXED    
Severity: enhancement CC: bkohler
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: mcelog timestamp patch

Description Denilson Sá Maia 2009-04-24 22:59:20 UTC
Currently, the /etc/cron.daily/mcelog file logs new exceptions to /var/log/mcelog, but does not write any timestamp. This is not very useful, because we usually check logs long time after the error has occurred.

Thus, I've made a very small 1-line enhacement that adds the timestamp to each log entry.

At /etc/cron.daily/mcelog file, change this line:
/usr/sbin/mcelog --ignorenodev --filter >> /var/log/mcelog
To this:
/usr/sbin/mcelog --ignorenodev --filter | awk '{s=s $0 "\n"} END{ if(NR > 0){ printf("%s\n%s",strftime("%F %T %Z"),s) }}' >> /var/log/mcelog

This little awk script (tested with gawk) will print the timestamp if, and only if, the output of mcelog command is not empty.
Comment 1 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2009-04-25 16:58:22 UTC
Could you please provide this change as handy patch file? Preferrably as unified diff (diff -u)...
Comment 2 Denilson Sá Maia 2009-04-25 17:09:44 UTC
Created attachment 189406 [details, diff]
mcelog timestamp patch

Here is the patch. Quite simple

Would be nice to submit this patch to upstream. Could anyone please do that for me?

By the way, I've just noticed that there is a mcelog-0.8_pre1-timestamp-mcelog.patch already in portage, but only for the currently masked package. It would be worthy to backport that patch to current stable version.
Comment 3 Ben Kohler gentoo-dev 2012-01-18 02:55:46 UTC
Current stable has this patch, time to close the bug?
Comment 4 Agostino Sarubbo gentoo-dev 2012-08-19 12:41:34 UTC
This package is now maintainer-needed. If you want proxy-maintain it, poke the relative herd.
Comment 5 Pacho Ramos gentoo-dev 2012-09-16 10:07:02 UTC
(In reply to comment #3)
> Current stable has this patch, time to close the bug?