←back to thread

466 points CoolCold | 2 comments | | HN request time: 0.416s | source
Show context
kbar13 ◴[] No.40208219[source]
systemd has been a net positive for the linux ecosystem. remember when you had to write bash scripts to start, stop, restart services and handle any other signals you want to send it? nowadays it's a unit file (basically just an ini file) away with relatively straightforward API. and you can actually declare startup dependencies and other useful relationships past just "prepend a number signifying when it should run globally to the front of the filename". it's provided an extensible platform with which higher level orchestration frameworks like ansible / ignition can easily templatize services or other system configuration.

since the beginning of systemd people have moaned about how complex it is and how we're reinventing the wheel. yet time and time again the people actually working on the project show that the solution they've come up with is the result of the problem they're facing on a daily basis. it's quite annoying that the armchair linux experts complain about how "lol systemd is so stupid for reinventing the wheel, give me my shell scripts back", maybe think about whether or not you have a legitimate issue not being addressed by the solution proposed or if you are just getting rage baited by a headline.

replies(17): >>40208249 #>>40208286 #>>40208374 #>>40208481 #>>40209110 #>>40209185 #>>40212620 #>>40212965 #>>40214704 #>>40214800 #>>40214923 #>>40215163 #>>40215552 #>>40215793 #>>40216445 #>>40217144 #>>40217617 #
agilob ◴[] No.40214923[source]
> remember when you had to write bash scripts to start, stop, restart services

This was a really big pain, yes, but I also remember how I could `tail -f *.logs`. I remember how I didn't need to remember about `--no-pager` and `--follow`. I knew where the files were, what they were called. I remember how I didn't have to google how to find logs between 10 days ago and 4 days ago, because the logs would be in a .tar created by logrotate with a date in the filename.

The init system was probably peak of systemd, after that they started reinveting things in a more complicated way. Do we really need journald, systemd-boot, machinectl, systemd-networkd, sd-bus, systemd-resolved, systemd-nspawn? Do people actually use it all? Are there any metrics to show how many systems have it installed and in use?

replies(8): >>40215028 #>>40215089 #>>40215154 #>>40215742 #>>40216065 #>>40216893 #>>40217407 #>>40218927 #
superb_dev ◴[] No.40215028[source]
The follow argument is identical to tail `-f`. `sudo journalctl -f -u <service name>`
replies(2): >>40215268 #>>40215896 #
rangerelf ◴[] No.40215268[source]
And what would be the equivalent to, "Oh, I don´t know the name of the log for this process I can see in 'ps aux', let me cd into /var/log and see what filenames I can find ... or grep everything until I can find a couple of words that make some sense so I can keep digging further"?

The lack of explorability in journalctl, the "need" to keep everything locked behind their own flavor of tools and magic file types, is what makes the rest of us abhor them.

replies(6): >>40215373 #>>40215724 #>>40215825 #>>40216093 #>>40216232 #>>40217449 #
superb_dev ◴[] No.40215724[source]
Well `-u` refers to the unit file, so I would start with `sudo systemctl status` which lists the status of active unit files. I bet I could find the unit name I'm looking for there. If not, then `sudo systemctl list-units` should have it. (and you can grep the output of both)

Systemd and Journald are less opaque than I used to think. Even if you don't want to learn the commands, all of its unit files (and the relationships between them) are available through the filesystem. Most of your unit files will be in `/etc/systemd/system`, and the active relationships between units are expressed through soft links.

replies(2): >>40217753 #>>40218606 #
aeonik ◴[] No.40217753[source]
How would you exclude certain units from your logs? Let's say that Auditd is spamming your logs, and you just want to exclude those?

Can you filter on search? How do you prevent applications from writing to Systemd at all?

replies(1): >>40219117 #
1. superb_dev ◴[] No.40219117[source]
I would start with `man systemd`, or maybe `journalctl —help`.

If you don’t want a service to log to systemd, then don’t run it in systemd?

replies(1): >>40219957 #
2. pcthrowaway ◴[] No.40219957[source]
I think you can also configure the journal per unit right? Don't remember how exactly, at the very least you can stream logs to a different system.

There are also services which will just use their own logging convention for some reason. Honestly it's easier just to go with journalctl for everything you can.