meta-google: rsyslog: Disable ForwardToSyslog
In rsyslog, the logs are read via the journal files like with
`journalctl`. The socket used by ForwardToSyslog is not used at all
(`run/systemd/journal/syslog`), so we will disable the forwarding to
avoid unnecessary work.
With the logs spamming the CPU usage of systemd-journald went down
after this change.
Before:
Always top 1 or two in CPU usage,
```
PID USER PRI NI VIRT RES SHR S CPU%-MEM% TIME+ Command
30892 root 20 0 23520 10108 9720 R 84.3 1.0 0:37.72 /usr/lib/systemd/systemd-journald
```
After:
Less CPU usage overall.
```
PID USER PRI NI VIRT RES SHR S CPU%-MEM% TIME+ Command
30976 root 20 0 23520 7608 7216 R 40.8 0.8 2:32.36 /usr/lib/systemd/systemd-journald
```
Reference:
- https://www.freedesktop.org/software/systemd/man/journald.conf.html#Forwarding%20to%20traditional%20syslog%20daemons
Change-Id: I50cf868d63697fc9b72529863bb83d249f3275c7
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/meta-google/recipes-extended/rsyslog/rsyslog_%.bbappend b/meta-google/recipes-extended/rsyslog/rsyslog_%.bbappend
index f81c9d7..ee75641 100644
--- a/meta-google/recipes-extended/rsyslog/rsyslog_%.bbappend
+++ b/meta-google/recipes-extended/rsyslog/rsyslog_%.bbappend
@@ -2,6 +2,18 @@
SRC_URI:append:gbmc = " \
file://rsyslog.conf \
+ file://journald.conf \
"
PACKAGECONFIG:append:gbmc = " imjournal"
+
+FILES:${PN}:append:gbmc = "\
+ ${systemd_unitdir}/journald.conf.d/ \
+"
+
+# Set ForwardToSyslog=no
+# Disable forward journal to socket since that is not being used.
+do_install:append:gbmc() {
+ install -D -m0644 ${WORKDIR}/journald.conf \
+ ${D}${systemd_unitdir}/journald.conf.d/99-${PN}.conf
+}