Hi,
In /etc/sysctl.conf I have
kern.msgbuf_show_timestamp=1
and so dmsg has things like
[1353919] swp_pager_getswapspace(32): failed
the [1353919] I guess being the timestamp.
But what is it?
Seconds since boot?
If it's that, then where can the true boot time be
found?
Hi,
In /etc/sysctl.conf I have
kern.msgbuf_show_timestamp=3D1
and so dmsg has things like
[1353919] swp_pager_getswapspace(32): failed
the [1353919] I guess being the timestamp.
But what is it?
Seconds since boot?
If it's that, then where can the true boot time be
found?
If not, then what does the number signify?
--
void <void@f-m.fm> wrote:e,
Hi,
In /etc/sysctl.conf I have
kern.msgbuf_show_timestamp=3D1
and so dmsg has things like
[1353919] swp_pager_getswapspace(32): failed
the [1353919] I guess being the timestamp.
But what is it?
Seconds since boot?
If it's that, then where can the true boot time be
found?
Yes! You can get the value from sysctl kern.boottime.
Here is a small program I wrote a while back, just call it
as a dmesg substitute.
It uses gawk because of strftime, but now that native awk handles strftim=
it could be converted to use that (gensub will have to be modified)f
gawk is in lang/gawk
Incidentally, if you put the kern.msgbuf_show_timestamp=3D1
in boot/loader.conf instead, it starts much earlier in the boot process, useful if you are anal about the format of bootup dmesg output!
Cheers, Jamie
#!/bin/sh -efu
set -efu
boottime=3D"$(/sbin/sysctl -n kern.boottime | /usr/local/bin/gawk '{print=
"%d", gensub ("^.* sec =3D ([1-9][0-9]*), .*$", "\\1", 1)}')"
[ -z "$(printf '%s' "$boottime" | /usr/bin/egrep '^0$|^[1-9][0-9]*$')" ]
&& { printf 'Invalid boottime retrieved.\n' >& 2; exit 1; }
/sbin/dmesg "$@" | /usr/local/bin/gawk -v boottime=3D"$boottime" '
{
uptime =3D gensub ("^\\[([1-9][0-9]*)\\] .*$", "\\1", 1)
if (uptime =3D=3D $0) realtime =3D "??? ?? ??:??;??"
else realtime =3D strftime ("%b %d %T", uptime + boottime)
print realtime " " $0
}'
Very cool!
Yes! You can get the value from sysctl kern.boottime.
Here is a small program I wrote a while back, just call it
as a dmesg substitute.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 54 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 12:20:09 |
| Calls: | 742 |
| Files: | 1,218 |
| D/L today: |
2 files (2,024K bytes) |
| Messages: | 183,175 |
| Posted today: | 1 |