DevOps Notebook: systemd and journalctl

Systemd and Journalctl are modern tools for Linux admins now a days. In this post I am trying to capture important details for quick understanding.

systemd

Systemd is an init system and system manager recently adopted by Linux systems. Definition from linux manual -

Commands which can help

systemctl status kubelet.service
systemctl start kubelet.service
systemctl stop kubelet.service
systemctl reload kubelet.service
systemctl restart kubelet.service
systemctl enable kubelet.service
systemctl is-active kubelet.service
systemctl is-enabled kubelet.service
systemctl list-units -all
systemctl list-unit-files | grep service | grep enabled
systemctl list-units --type=service# config filesystemctl cat kubelet.service# dependencies systemctl list-dependencies kubelet.service

One of the main benefit behind the systemd journal is to centralize the management of logs regardless of where the messages are originating. With systemd all the system, boot, and kernel log files are collected and managed by a central, dedicated logging solution. The journald daemon collects data from all available sources and stores them in a binary format for easy and dynamic manipulation.

More Details on systemd-

journalctl

Linux system logging changed with the introduction of systemd.
journalctl command can be used to read and filter system logs.

To view the logs that the journald daemon has collected, use the journalctl command.

jourcalctl
# to view the logs of current boot
journalctl -b
# list boots
journalctl --list-boots

Logs can be filters by unit as well.

systemctl list-units -all | grep -i kubelet.service# once you get your service you can check the logs                                                                                                                             journalctl -u kubelet.servicejournalctl -u kubelet.service --since today# by process idjournalctl _PID=16852# control the number of lines or entries journalctl -n 30# tail logsjournalctl -f

That’s All for this post. I will update this post again if I get any important update. Thanks.

In quest of understanding How Systems Work !

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store