From ecbdb45c0a904c74f32bb757ddb99e915627fa1f Mon Sep 17 00:00:00 2001
From: Jan Vondra <jan.vondra@ultimum.io>
Date: Thu, 28 Mar 2019 14:02:06 +0100
Subject: [PATCH] Added cmdline information into fluentFormatter event message

Since process_name value defaults to "MainProcess" a new field cmdline
has been added in order to get information which process (daemon)
triggers the event.

Change-Id: I1d7713ff7de930e40fc5b8ceb2cf2af54082c9cc
Closes-Bug: 1822101
---
 oslo_log/formatters.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/oslo_log/formatters.py b/oslo_log/formatters.py
index 8386ccc1..0ed54f81 100644
--- a/oslo_log/formatters.py
+++ b/oslo_log/formatters.py
@@ -301,6 +301,7 @@ class FluentFormatter(logging.Formatter):
             self.hostname = socket.gethostname()
         except socket.error:
             self.hostname = None
+        self.cmdline = " ".join(sys.argv)
 
     def formatException(self, exc_info, strip_newlines=True):
         try:
@@ -324,6 +325,7 @@ class FluentFormatter(logging.Formatter):
                    'module': record.module,
                    'funcname': record.funcName,
                    'process_name': record.processName,
+                   'cmdline': self.cmdline,
                    'hostname': self.hostname,
                    'traceback': None,
                    'error_summary': _get_error_summary(record)}