meta-ampere: rsyslog: support IPMI SEL

Enable rsyslog to save IPMI SEL event into /var/log/ipmi_sel.

Tested:
1. Log IPMI SEL event using xyz.openbmc_project.Logging.IPMI
2. Check /var/log/ipmi_sel for the new entry
 root@mtjade:~# cat /var/log/ipmi_sel
 2021-09-01T09:23:49.022943+00:00 1,c0,3ACD000FEB00000000000000,,,

Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com>
Change-Id: Ic02a6166498251ed1e84a56e4847f465a069c872
diff --git a/meta-ampere/meta-common/recipes-extended/rsyslog/rsyslog/rsyslog.conf b/meta-ampere/meta-common/recipes-extended/rsyslog/rsyslog/rsyslog.conf
index 656f1d3..121833f 100644
--- a/meta-ampere/meta-common/recipes-extended/rsyslog/rsyslog/rsyslog.conf
+++ b/meta-ampere/meta-common/recipes-extended/rsyslog/rsyslog/rsyslog.conf
@@ -12,7 +12,26 @@
 # journal workaround to avoid duplicate entries
 module(load="imjournal" StateFile="/var/log/state"
                         RateLimit.Interval="60"
-                        RateLimit.Burst="2000")
+                        RateLimit.Burst="4000")
+
+# Template for IPMI SEL messages
+# "<timestamp> <ID>,<Type>,<EventData>,[<Generator ID>,<Path>,<Direction>]"
+template(name="IPMISELTemplate" type="list") {
+    property(name="timereported" dateFormat="rfc3339")
+    constant(value=" ")
+    property(name="$!IPMI_SEL_RECORD_ID")
+    constant(value=",")
+    property(name="$!IPMI_SEL_RECORD_TYPE")
+    constant(value=",")
+    property(name="$!IPMI_SEL_DATA")
+    constant(value=",")
+    property(name="$!IPMI_SEL_GENERATOR_ID")
+    constant(value=",")
+    property(name="$!IPMI_SEL_SENSOR_PATH")
+    constant(value=",")
+    property(name="$!IPMI_SEL_EVENT_DIR")
+    constant(value="\n")
+}
 
 # Template for Redfish messages
 # "<timestamp> <MessageId>,<MessageArgs>"
@@ -37,6 +56,13 @@
 }
 
 
+# If the journal entry has the IPMI SEL MESSAGE_ID, save as IPMI SEL
+# The MESSAGE_ID string is generated using journalctl and must match the
+# MESSAGE_ID used in IPMI to correctly find the SEL entries.
+if ($!MESSAGE_ID == "b370836ccf2f4850ac5bee185b77893a") then {
+   action(type="omfile" file="/var/log/ipmi_sel" template="IPMISELTemplate")
+}
+
 # If the journal entry has a Redfish MessageId, save as a Redfish event
 if ($!REDFISH_MESSAGE_ID != "") then {
    action(type="omfile" file="/var/log/redfish" template="RedfishTemplate")