From nobody Sun Aug 28 16:57:15 2022 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MG09d6KmNz4ZyBJ for ; Sun, 28 Aug 2022 16:57:25 +0000 (UTC) (envelope-from pete@nomadlogic.org) Received: from mail.nomadlogic.org (mail.nomadlogic.org [66.165.241.226]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.nomadlogic.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MG09d07XNz3NXv for ; Sun, 28 Aug 2022 16:57:24 +0000 (UTC) (envelope-from pete@nomadlogic.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nomadlogic.org; s=04242021; t=1661705837; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=v3J/ab51kogxDC/SMCqXi0HWwmAOKuZ5fmIJJuMGkUw=; b=JGXK+iM26OxL/ugf+6B2E00X1n05n1ybZ2gP9ghfqbAFpwhlupsT37kp7srlPe/pSlHXma jf6AJTUdx3uDa3NrlNybbFlA1/acfU5pl0ZeSJ5oy/BkKHNF68ZZpG/zrwocDZRv6egl2F N7i4f/DJ+LINpO7DAtW4TLnPlvT6XLQ= Received: from shelly.nomadlogic.org (66-165-241-229.static.hvvc.us [66.165.241.229]) by mail.nomadlogic.org (OpenSMTPD) with ESMTPSA id a3680d9b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Sun, 28 Aug 2022 16:57:16 +0000 (UTC) Date: Sun, 28 Aug 2022 16:57:15 +0000 From: Pete Wright To: freebsd-questions@freebsd.org Subject: Re: turn on timestamps in kernel log messages? Message-ID: <20220828165715.fr3gvjk2esatukn5@shelly.nomadlogic.org> References: List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4MG09d07XNz3NXv X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=nomadlogic.org header.s=04242021 header.b=JGXK+iM2; dmarc=pass (policy=quarantine) header.from=nomadlogic.org; spf=pass (mx1.freebsd.org: domain of pete@nomadlogic.org designates 66.165.241.226 as permitted sender) smtp.mailfrom=pete@nomadlogic.org X-Spamd-Result: default: False [-3.00 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[nomadlogic.org,quarantine]; R_SPF_ALLOW(-0.20)[+mx]; R_DKIM_ALLOW(-0.20)[nomadlogic.org:s=04242021]; MIME_GOOD(-0.10)[text/plain]; ASN(0.00)[asn:29802, ipnet:66.165.240.0/22, country:US]; MIME_TRACE(0.00)[0:+]; MLMMJ_DEST(0.00)[freebsd-questions@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[nomadlogic.org:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N 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