journald - ability to prefix events with timestamps in system time when forwarded to console
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 16.7k
- Forks
- 4.7k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 140
Description
Submission type
- Bug report
- Request for enhancement (RFE)
NOTE: Do not submit anything other than bug reports or RFEs via the issue tracker!
systemd version the issue has been seen with
v299+
Used distribution
N/A
In case of bug report: Expected behaviour you didn't see
Timestamped events emitted to console using local system time
In case of bug report: Unexpected behaviour you saw
Events spooled to console use seconds since boot. e.g:
[ 880.140763] CRON[3279]: pam_unix(cron:session): session opened for user root by (uid=0)
Steps to reproduce the problem
By enabling ForwardToConsole and setting an appropriate TTYPath journald can spool events to console:
ForwardToConsole=yes
TTYPath=/dev/console
While I wasn't able to find documentation on getting journald to emit a timestamp to the console, I stumbled upon "/sys/module/printk/parameters/time" [0]. By setting this parameter you can get journald to prefix events with the time since boot, but there is no support for utilizing the current system time [1].
[0] https://github.com/systemd/systemd/blob/master/src/journal/journald-console.c#L36-49
[1] https://github.com/systemd/systemd/blob/master/src/journal/journald-console.c#L72-79
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/journal/journald-console.c, especially the linked sections handling /sys/module/printk/parameters/time and console output. Trace how ForwardToConsole and TTYPath reach this code, then determine how a system-time prefix should be represented. Done means forwarded console events can use the current system time rather than only seconds since boot.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100