Messages in this thread | | | Date | Thu, 7 Dec 2017 23:01:04 +0900 | From | Sergey Senozhatsky <> | Subject | Re: [RFC][PATCH] printk: add console_msg_format command line option |
| |
Hi,
On (12/07/17 14:48), Petr Mladek wrote: [..] > > This patch introduces a `console_msg_format=' command line option, > > to switch between different message formatting on serial consoles. > > For the time being we have just one option - syslog. This option > > makes serial console messages to appear in syslog format, matching > > the `dmesg --raw' and `cat /proc/kmsg' output formats: > > I have realized that 'cat /proc/kmsg' did not work. It can be done using:
hm, it does work on my system. what do you mean by 'did not work'?
> Also the format is more comlicated here, see printk.c: > > * /dev/kmsg exports the structured data in the following line format: > * "<level>,<sequnum>,<timestamp>,<contflag>[,additional_values, ... ];<message text>\n"
that's /dev/kmsg. /dev/kmsg != /proc/kmsg. I never mentioned /dev/kmsg in my commit. /dev/kmsg prints the extended stuff, /proc/kmsg does not.
> > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > > index 28467638488d..2dd91c5073f9 100644 > > --- a/Documentation/admin-guide/kernel-parameters.txt > > +++ b/Documentation/admin-guide/kernel-parameters.txt > > @@ -643,6 +643,16 @@ > > console=brl,ttyS0 > > For now, only VisioBraille is supported. > > > > + console_msg_format= > > + [KNL] Control message format > > + By default we print messages in "[time stamp] text\n" > > + format (time stamp may not be printed, depending on > > + CONFIG_PRINTK_TIME or `printk_time' param). > > + syslog > > + Switch to syslog format (similar to "dmesg --raw" or > > + reading from /proc/kmsg): "<%u>[time stamp] text\n" > > To be precise, it exactly the same as "dmesg -S --raw". Also it is the > format used by SYSLOG_ACTION_READ* actions of the syslog syscall.
hmm... `dmesg -S --raw' doesn't show anything on my system. `dmesg --raw' matches the console_msg_format=syslog.
> > +static int __init console_msg_format_setup(char *str) > > +{ > > + if (!strncmp(str, "syslog", 6)) > > + console_msg_format = MSG_FORMAT_SYSLOG; > > It might make sense to accept also the "default" format. > > > + return 1; > > +} > > +__setup("console_msg_format=", console_msg_format_setup); > > I would use early_param() so that it takes effect as soon as possible.
ok. can take a look.
-ss
| |