<div dir="ltr">I would like to second this - that having different policies for different log levels can be very useful. Also filtering these during log view.</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, May 20, 2025 at 11:14 AM Etienne Doms <<a href="mailto:etienne.doms@gmail.com">etienne.doms@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
We're developing an embedded application which is run through a<br>
systemd service, and we use sd-journal for logging.<br>
<br>
We just figured out that something is not scaling up: we log at INFO<br>
level things like "user pushed that button so we did that" (which<br>
occurs once in a while) and at DEBUG level "received that frame from<br>
/dev/ttyUSB42" which occurs every 40ms on various serial lines. There<br>
is no I/O issue since we use Storage=volatile, but the journal is<br>
rotating way too fast.<br>
<br>
At first sight, it seems we just need to dynamically enable/disable<br>
DEBUG messages but the problem is that we can't: in the wild, the<br>
operator of our system can press a "something went wrong" button which<br>
basically does a journal export that we can inspect later, and<br>
obviously we can't predict when a problem is about to happen...<br>
<br>
So basically, we need to be able at any time to persist one hour of<br>
INFO messages and the last five minutes of DEBUG messages. From what I<br>
understood, the retention strategy is global to a systemd-journald<br>
instance, I read about sd-journal namespaces, and my first intent was<br>
to log INFO stuff in the system journal and DEBUG stuff in dedicated<br>
namespaces (maybe one per serial lines), so I've been looking for some<br>
sd_journal_print_with_namespace() or sd_journal_sendv([MESSAGE="foo",<br>
NAMESPACE="bar"])...<br>
<br>
Now, two questions:<br>
<br>
* What I'm looking for does not exist, a systemd unit is bound to a<br>
single journal namespace, and it's actually the .service that defines<br>
to which namespace the application logs. Am I right? To achieve what I<br>
want, I need to split my application into several services?<br>
* Is systemd-journald designed so that it can record hundreds (if not<br>
thousands...) of records per second?<br>
<br>
$COLLEAGUE proposed to switch to rsyslog, but I'd like your reading about this.<br>
<br>
Thanks in advance,<br>
Etienne<br>
<br>
</blockquote></div>