meta-facebook: rsyslog: Allow reading server console logs
Generate host server log files to load logs from obmc-console.
This allows us to input /var/log/obmc-console*.log and
potentially be able to stream it to an external syslog
server (if configured to do so).
Change-Id: I8146f499a47971501b3abe85e6d8026216d3d0b4
Signed-off-by: Amithash Prasasd <amithash@meta.com>
diff --git a/meta-facebook/recipes-extended/rsyslog/rsyslog/rsyslog-oob-console.conf.in b/meta-facebook/recipes-extended/rsyslog/rsyslog/rsyslog-oob-console.conf.in
new file mode 100644
index 0000000..559798b
--- /dev/null
+++ b/meta-facebook/recipes-extended/rsyslog/rsyslog/rsyslog-oob-console.conf.in
@@ -0,0 +1,17 @@
+# Do not queue these, write immediately
+$ActionQueueType Direct
+
+# Send all console logs out as local3.debug logs.
+# local3 is an arbitrary choice among local1-7
+# to ensure we dont conflict with other services.
+# reopenOnTruncate+freshStartTail - ensures we
+# reopen when obmc-console rotates the log-file
+# and start a fresh on the new file.
+input(type="imfile"
+ File="/var/log/obmc-console-__OOB_CONSOLE_HOST__.log"
+ Tag="oob_console[mTerm___OOB_CONSOLE_HOST__]"
+ Severity="debug"
+ Facility="local3"
+ reopenOnTruncate="on"
+ freshStartTail="on"
+)
diff --git a/meta-facebook/recipes-extended/rsyslog/rsyslog/rsyslog.conf b/meta-facebook/recipes-extended/rsyslog/rsyslog/rsyslog.conf
index e84f7a5..d59ca08 100644
--- a/meta-facebook/recipes-extended/rsyslog/rsyslog/rsyslog.conf
+++ b/meta-facebook/recipes-extended/rsyslog/rsyslog/rsyslog.conf
@@ -48,6 +48,10 @@
if ($!REDFISH_MESSAGE_ID != "") then {
action(type="omfile" file="/var/log/redfish" template="RedfishTemplate")
}
+
+# At least one of the consoles will require streaming host console.
+module(load="imfile")
+
#
# Include all config files in /etc/rsyslog.d/
#
diff --git a/meta-facebook/recipes-extended/rsyslog/rsyslog_%.bbappend b/meta-facebook/recipes-extended/rsyslog/rsyslog_%.bbappend
index e60b3e8..5fd46bd 100644
--- a/meta-facebook/recipes-extended/rsyslog/rsyslog_%.bbappend
+++ b/meta-facebook/recipes-extended/rsyslog/rsyslog_%.bbappend
@@ -1,9 +1,12 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+require conf/recipes/fb-consoles.inc
+
SRC_URI += "file://rsyslog.conf \
file://rsyslog.logrotate \
file://rotate-event-logs.service \
file://rotate-event-logs.timer \
+ file://rsyslog-oob-console.conf.in \
"
PACKAGECONFIG:append = " imjournal klog imfile"
@@ -12,6 +15,12 @@
install -m 0644 ${WORKDIR}/rotate-event-logs.service ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/rotate-event-logs.timer ${D}${systemd_system_unitdir}
rm ${D}${sysconfdir}/rsyslog.d/imjournal.conf
+ for host in ${OBMC_HOST_INSTANCES}; do
+ host_name="host${host}"
+ conf=${D}${sysconfdir}/rsyslog.d/${host_name}.conf
+ install -m 644 ${WORKDIR}/rsyslog-oob-console.conf.in ${conf}
+ sed -i "s/__OOB_CONSOLE_HOST__/${host_name}/g;" ${conf}
+ done
}
SYSTEMD_SERVICE:${PN} += " rotate-event-logs.service rotate-event-logs.timer"