LWN: Comments on "Reimplementing printk()" https://lwn.net/Articles/780556/ This is a special feed containing comments posted to the individual LWN article titled "Reimplementing printk()". en-us Thu, 02 Oct 2025 03:32:25 +0000 Thu, 02 Oct 2025 03:32:25 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Reimplementing printk() https://lwn.net/Articles/782415/ https://lwn.net/Articles/782415/ jdel <div class="FormattedComment"> printk goes straight out serial console ports. journald just taps into a copy of the console data to log it locally.<br> </div> Wed, 06 Mar 2019 13:10:46 +0000 Reimplementing printk() https://lwn.net/Articles/782412/ https://lwn.net/Articles/782412/ jogness <div class="FormattedComment"> If you can call dmesg, I expect you can read /dev/kmsg as well. Take a look at the output of:<br> <p> cat /dev/kmsg<br> <p> The second field is the sequence number. You can read about the format here:<br> <p> <a href="https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg">https://www.kernel.org/doc/Documentation/ABI/testing/dev-...</a><br> </div> Wed, 06 Mar 2019 10:46:13 +0000 Reimplementing printk() https://lwn.net/Articles/782404/ https://lwn.net/Articles/782404/ gravious <div class="FormattedComment"> The older distros you care about won't have this new printk() stuff backported, surely?<br> </div> Wed, 06 Mar 2019 07:39:18 +0000 Reimplementing printk() https://lwn.net/Articles/781003/ https://lwn.net/Articles/781003/ Cyberax <div class="FormattedComment"> I get piped dmesg output. I can play with its options but I don't see how I can make it print sequence numbers.<br> </div> Thu, 28 Feb 2019 20:34:46 +0000 Reimplementing printk() https://lwn.net/Articles/780889/ https://lwn.net/Articles/780889/ Cyberax <div class="FormattedComment"> I'm dreaming about the moment I can do this :( For now there's still RHEL6 and Amazon Linux 1 that I need to support.<br> </div> Wed, 27 Feb 2019 22:15:03 +0000 Reimplementing printk() https://lwn.net/Articles/780882/ https://lwn.net/Articles/780882/ claytonc <div class="FormattedComment"> Maybe they are on a distro without systemd?<br> </div> Wed, 27 Feb 2019 21:00:56 +0000 Reimplementing printk() https://lwn.net/Articles/780881/ https://lwn.net/Articles/780881/ rweikusat2 <div class="FormattedComment"> Diagnostic output isn't supposed to be "parsed by software", that's usually just a crude attempt at getting around lack of an interfacen supposed to provided what said software really wants to have. Hence, optimizing the output format to make the crude workaround easier to implement at the expense of making the intended purpose (debugging) more complicated are a bad idea.<br> <p> There's nothing "controversial" here, just lack of understanding.<br> <p> </div> Wed, 27 Feb 2019 20:54:00 +0000 Reimplementing printk() https://lwn.net/Articles/780865/ https://lwn.net/Articles/780865/ vadim <div class="FormattedComment"> Why not take advantage of that journald already has the metadata needed to uniquely identify a line?<br> </div> Wed, 27 Feb 2019 16:44:46 +0000 Reimplementing printk() https://lwn.net/Articles/780812/ https://lwn.net/Articles/780812/ jogness <div class="FormattedComment"> Isn't dmesg just using /dev/kmsg? Or are you using "dmesg -S"?<br> </div> Wed, 27 Feb 2019 11:10:33 +0000 Print less https://lwn.net/Articles/780810/ https://lwn.net/Articles/780810/ LtWorf <div class="FormattedComment"> Ah, had this discussion with a coworker, who doesn't want to remove the "verbose" from tar in build logs… Which makes build logs 99% the same list of files over and over.<br> </div> Wed, 27 Feb 2019 10:39:18 +0000 Reimplementing printk() https://lwn.net/Articles/780809/ https://lwn.net/Articles/780809/ Cyberax <div class="FormattedComment"> I can't read /dev/kmsg, it might not be accessible. dmesg is all I can reliably get :(<br> </div> Wed, 27 Feb 2019 09:45:06 +0000 Reimplementing printk() https://lwn.net/Articles/780808/ https://lwn.net/Articles/780808/ jani <div class="FormattedComment"> <font class="QuotedText">&gt; I guess this idea could be as controversial as systemd :-)</font><br> <p> That part would be <a href="https://lwn.net/Articles/464276/">https://lwn.net/Articles/464276/</a><br> <p> </div> Wed, 27 Feb 2019 09:42:45 +0000 Reimplementing printk() https://lwn.net/Articles/780806/ https://lwn.net/Articles/780806/ NAR If logs are parsed by software, what about using a more structured log format like <A HREF="https://brandur.org/logfmt">logmft</A>? I guess this idea could be as controversial as systemd :-) Wed, 27 Feb 2019 09:24:05 +0000 Reimplementing printk() https://lwn.net/Articles/780804/ https://lwn.net/Articles/780804/ jogness <div class="FormattedComment"> The point of making emergency messages stand out is exactly for easier automatic processing. From the cover letter:<br> <p> "Right now the emergency messages are set apart from the non-emergency messages using '\n'. There have been requests that some special markers could be specifiable to make it easier for parsers."<br> </div> Wed, 27 Feb 2019 08:49:05 +0000 Reimplementing printk() https://lwn.net/Articles/780802/ https://lwn.net/Articles/780802/ jogness <div class="FormattedComment"> You really should be using the sequence number. That is a reliable, monotonically increasing value. (For my proposal as well.) Also, it allows you to identify if messages are missing.<br> </div> Wed, 27 Feb 2019 08:45:12 +0000 Reimplementing printk() https://lwn.net/Articles/780800/ https://lwn.net/Articles/780800/ Cyberax <div class="FormattedComment"> The application itself is designed to be restartable and I'm using the timestamp to find out unsynchronized logs - I'm just checking the last uploaded log timestamp and then proceed to sync everything that is at or after that timestamp.<br> <p> Multiple entries with the same timestamp are treated just fine (de-duped), the problem is timestamps going backwards.<br> <p> I guess I'll have to add more complicated logic to detect unsynchronized messages.<br> </div> Wed, 27 Feb 2019 07:06:36 +0000 Print less https://lwn.net/Articles/780799/ https://lwn.net/Articles/780799/ shemminger <div class="FormattedComment"> What about silence?<br> 99% of what is in the kernel log is leftovers that some developer was too timid or vain to remove.<br> </div> Wed, 27 Feb 2019 06:06:01 +0000 Reimplementing printk() https://lwn.net/Articles/780797/ https://lwn.net/Articles/780797/ smurf <div class="FormattedComment"> What does your tool do with boot messages? Today, the first 20 lines or so always end up with a timestamp of zero.<br> <p> In any case, if I were you I'd add my own timestamp (time when the message was read from the kernel).<br> </div> Wed, 27 Feb 2019 03:40:00 +0000 Reimplementing printk() https://lwn.net/Articles/780795/ https://lwn.net/Articles/780795/ Cyberax <div class="FormattedComment"> I have a tool that depends on increasing message timestamps (it uses them as a position marker). Would it be possible to add an option to fall back to the previous behavior for timestamps?<br> </div> Wed, 27 Feb 2019 01:23:25 +0000 Reimplementing printk() https://lwn.net/Articles/780792/ https://lwn.net/Articles/780792/ gdt <div class="FormattedComment"> Options to make messages stand out more tend to be painful when automatically processing log messages. Kernel programmers are humans and want log output tuned for humans, but many more log readers are scripts using some sort of regular expression.<br> </div> Wed, 27 Feb 2019 00:43:23 +0000