system-log: Handle raw kernel messages. #67
No reviewers
Labels
No labels
bug
contribution welcome
duplicate
enhancement
good first issue
help wanted
invalid
question
upstream
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
shepherd/shepherd!67
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "yelninei/syslog-raw-kernel"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
variable.
(parse-system-log-message): Add kernel? keyword.
(read-system-log-message): Add kernel-keyword and propagate it.
(run-system-log): Add kernel-port keyword.
Fixes shepherd/shepherd#46
This seems to work for the guix hurd (ontop of the wip pr to fix select/poll for streamio)
I am using
%default-kernel-priorityascriticalto match inetutils syslogd but the more important thing is setting facility to kernel to letsystem-log-message->stringknow that this is a kernel message.Currently the call to
parse-system-log-messageinlog-bytesis always assumed to be not from the kernel port.otherwise we would need to propagate this there as well.
It should also work when
#:kernel-portis#fbecause then we would compare a port to#fsystem-log: Handle raw kernel messages.to WIP: system-log: Handle raw kernel messages.Also one thing that this currently does not do is some validation on the facility:
When printing not a message from the klog inetutils syslog validates that the priority is in the correct range, the facility is not bigger than 24/ the max and prevents the non klog inputs from logging kernel messages by changing it to user.
This would also be doable now because we now know if we decode a kernel message and when not.
Similiarly the
#:kernel?parameter only affects the fallback facility and not the facility from a non kernel message in the kernel log.In the rsyslog documentation i found a note that on some bsds this indeed can happen (https://www.rsyslog.com/doc/configuration/modules/imklog.html)
Overall LGTM.
This one warrants a
NEWSentry too.Thanks!
@ -134,3 +134,3 @@(define %default-facility (system-log-facility user))(define* (parse-system-log-message line #:optional sender)(define %default-kernel-priority (system-log-priority critical))Given that
/dev/klog(Hurd) shows primarily debugging info, I would rather make itnoticeorinfo. WDYT?I agree.
I chose critical because it is syslogds default for unknown kenrel messages
DEFSPRI (LOG_KERN|LOG_CRIT).To confirm I also captured the kernel log from syslogd in its debug mode
I tried to look around what other syslogds do in that case but have not found aynthing else yet
if I unterstand the code correctly syslog-ng and rsyslog both use LOG_NOTICE as default which would give some symmetry with the non kernel case
@ -145,3 +138,3 @@(system-log-message facility+priority(match:suffix m) sender)))))(match:substring m 3) sender)))))Please extend the docstring like:
@ -253,1 +215,3 @@(loop ports))))((? eof-object?) #t)(line (put-message dispatcher (parse-system-log-message line))))(loop))Please extend the docstring to say that
kernel-portis used solely to determine whether one of the elements ofportscorresponds to the kernel log.c70c280a10to163352e57d@civodul
Should the socket case i.e.
log-bytesalso propagatekernel?toparse-system-log-messageor can I assume that the kernel log port is not a socket@Yelninei Let’s assume the kernel log is not a socket. This assumption holds on both Linux and the Hurd, and most likely on other free Unix-style systems.
163352e57dtob4e4facb15Added a news entry (and also corrected the path to the klog file in the other one).
Not sure if the term "raw message" is clearly defined but I hope it is understandable
WIP: system-log: Handle raw kernel messages.to system-log: Handle raw kernel messages.Nitpicking on the
NEWSbut otherwise LGTM! (Let me know if you prefer me to make these changes on your behalf.)@ -68,2 +68,3 @@as can be seen with /dev/kmsg on the Hurd.as can be seen with /dev/klog on the Hurd.** ‘system-log’ service supports raw messages from the kernel logs/supports .*/correctly identifies messages from the kernel log/
@ -70,0 +71,4 @@(<https://codeberg.org/shepherd/shepherd/issues/46>)When the ‘system-log’ service encounters a message without facility informationfrom the kernel log it will now treat it as a kernel message.s/it will now treat it/, it now treats it as a kernel message, prefixing it appropriately in the log./
@ -70,0 +72,4 @@When the ‘system-log’ service encounters a message without facility informationfrom the kernel log it will now treat it as a kernel message.This is the case with kernel messages from /dev/klog on the Hurd.Missing newline.
@civodul wrote in #67 (comment):
I'd be fine with you adjusting the NEWS as you see fit.