Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Aug 2022 16:57:15 +0000
From:      Pete Wright <pete@nomadlogic.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: turn on timestamps in kernel log messages?
Message-ID:  <20220828165715.fr3gvjk2esatukn5@shelly.nomadlogic.org>
In-Reply-To: <YwuEu68m6kiRFNrc@void.f-m.fm>
References:  <YwuEu68m6kiRFNrc@void.f-m.fm>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Aug 28, 2022 at 04:07:39PM +0100, void wrote:
> Hello,
> 
> In periodic daily emails it's recorded if there's anything
> in kernel log messages during the last 24 hrs. The problem
> is that the lines pertaining to these messages aren't timestamped
> so the information is of less use in tracking down a problem
> than it could be. Example:
> 
> +pid 96879 (conftest), jid 8779, uid 0: exited on signal 11 (core dumped)
> +tap2: link state changed to DOWN +swap_pager: out of swap space
> +swp_pager_getswapspace(7): failed
> 
> In the same email, login failures are timestamped.
> 
> Is there a way to have kernel log messages timestamped so they appear as
> such in periodic daily emails?
> 

i think you are looking for the kern.msgbuf_show_timestamp sysctl knob:

via dmesg(8)
kern.msgbuf_show_timestamp: 0
             If set to 0, no timetamps are added.  If set to 1, then a
             1-second granularity timestamp will be added to most lines in the
             message buffer.  If set to 2, then a microsecond granularity
             timestamp will be added.  This may also be set as a boot
             loader(8) tunable.  The timestamps are placed at the start of
             most lines that the kernel generates.  Some multi-line messages
             will have only the first line tagged with a timestamp.

-pete

-- 
Pete Wright
pete@nomadlogic.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220828165715.fr3gvjk2esatukn5>