-
Notifications
You must be signed in to change notification settings - Fork 0
/
journald.sh
65 lines (52 loc) · 1.42 KB
/
journald.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
# vim:set syntax=sh:
# kate: syntax bash;
# SPDX-License-Identifier: CC-BY-SA-4.0
# Copyright 2021 Jakob Meng, <[email protected]>
exit # do not run any commands when file is executed
########################################
#
# journald
#
cat << 'EOF' > /etc/systemd/journald.conf.d/fwd_to_tty12.conf
# 2019-2021 Jakob Meng, <[email protected]>
# Forward journald to /dev/tty12
# Ref.:
# man journald.conf
# https://wiki.archlinux.org/title/Systemd/Journal#Forward_journald_to_/dev/tty12
[Journal]
ForwardToConsole=yes
TTYPath=/dev/tty12
#MaxLevelConsole=info
EOF
cat << 'EOF' > /etc/systemd/journald.conf.d/max_size.conf
# 2021 Jakob Meng, <[email protected]>
# Enforce journald size limit
# Ref.:
# man journald.conf
# https://wiki.archlinux.org/title/Systemd/Journal#Journal_size_limit
[Journal]
SystemMaxUse=1G
EOF
cat << 'EOF' > /etc/systemd/journald.conf.d/no_syslog.conf
# 2021 Jakob Meng, <[email protected]>
# Do not forward log messages to syslog daemon
# Ref.:
# man journald.conf
[Journal]
ForwardToSyslog=no
EOF
# Enabling persistent logging in journald
# Ref.:
# /usr/share/doc/systemd/README.Debian
# https://unix.stackexchange.com/a/159390/188542
mkdir -p /var/log/journal
systemd-tmpfiles --create --prefix /var/log/journal
systemctl restart systemd-journald.service
########################################
# View logs
# sddm
sudo journalctl -b -u sddm
# X
journalctl -b
########################################