[systemd-devel] generator logging during daemon-reload

Lennart Poettering lennart at poettering.net
Mon Nov 10 11:39:23 PST 2014


On Mon, 10.11.14 20:30, Alexandre Detiste (alexandre.detiste at gmail.com) wrote:

> >> Yes, but then the log appears as a ugly big chunck without the
> >> timestamp & host on the left; 
> > > except the first line. Is it ok to reopen /dev/ksmg for each line
> > > writen to avoid this ?
> > 
> > Not sure I follow?
> 
> This might be a trivial problem; it's just that there are really few people
> writing generators or outputing do /dev/kmsg .
> 
> Here is a sample test case the 2 different behaviours,
> maybe a "flush" after the "write" would do it:
> 
> root at antec:/home/tchet# cat log
> <4> log1: log1
> <4> log2: log2
> <4> log3: log3
> <4> log4: log4
> root at antec:/home/tchet# LANG=C dd if=log of=/dev/kmsg
> 0+1 records in
> 0+1 records out
> 60 bytes (60 B) copied, 0.000114992 s, 522 kB/s
> root at antec:/home/tchet# while read level pgm msg; do echo $level $pgm $msg > /dev/kmsg; done < log
> root at antec:/home/tchet# journalctl -n
> ...
> nov 10 20:25:06 antec log1: log1
>                             <4> log2: log2
>                             <4> log3: log3
>                             <4> log4: log4
> nov 10 20:25:20 antec log1: log1
> nov 10 20:25:20 antec log2: log2
> nov 10 20:25:20 antec log3: log3
> nov 10 20:25:20 antec log4: log4

The kernel does some moronic line merging there. Consider just
reopening the device each time to avoid it...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list