sensor-monitor: Capture PID in event logs
Pass the PID of the process into an event log with the _PID additional
data entry. This gets done automatically when the report() or commit()
phosphor-logging event log library functions are called, but needs to be
done manually when the D-Bus API is used. This just provides a way to
see which process created the event log and I just forgot to do this
when I first wrote it..
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I094a0eb9634df53759f257799ae518ffd63e45cd
diff --git a/sensor-monitor/threshold_alarm_logger.cpp b/sensor-monitor/threshold_alarm_logger.cpp
index bab6002..f50fb6a 100644
--- a/sensor-monitor/threshold_alarm_logger.cpp
+++ b/sensor-monitor/threshold_alarm_logger.cpp
@@ -18,6 +18,7 @@
#include "sdbusplus.hpp"
#include <fmt/format.h>
+#include <unistd.h>
#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Logging/Entry/server.hpp>
@@ -229,6 +230,7 @@
}
ad.emplace("SENSOR_NAME", sensorPath);
+ ad.emplace("_PID", std::to_string(getpid()));
try
{