diff options
author | Aravinda VK <avishwan@redhat.com> | 2019-08-21 09:54:21 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@gmail.com> | 2019-08-21 14:00:29 +0000 |
commit | 4c4eae13b474c32661eeae3734627d1a8494cf54 (patch) | |
tree | c0487109fb891d58f368a5fed7d8a8c01fcc2846 /geo-replication | |
parent | b960e0103a70b58880b59438b116740af98a4582 (diff) |
geo-rep: Structured logging new format
Structured logging format changed in the below patch for better
readability and parsing. This patch changes the Geo-replication logs
to that format.
https://review.gluster.org/#/c/glusterfs/+/22987/
Before:
```
[2019-08-21 04:23:01.13672] I [monitor(monitor):157:monitor] Monitor: \
starting gsyncd worker<TAB>brick=/bricks/b1<TAB>slave_node=f29.sonne
```
After:
```
[2019-08-21 04:23:01.13672] I [monitor(monitor):157:monitor] Monitor: \
starting gsyncd worker [{brick=/bricks/b1}, {slave_node=f29.sonne}]
```
Change-Id: I65ec69a2869e2febeedc558f88620399e4a1a6a4
Updates: #657
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Diffstat (limited to 'geo-replication')
-rw-r--r-- | geo-replication/syncdaemon/syncdutils.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py index 2ee10ac09fb..0532a5e88d3 100644 --- a/geo-replication/syncdaemon/syncdutils.py +++ b/geo-replication/syncdaemon/syncdutils.py @@ -701,12 +701,12 @@ def lf(event, **kwargs): Log Format helper function, log messages can be easily modified to structured log format. lf("Config Change", sync_jobs=4, brick=/bricks/b1) will be - converted as "Config Change<TAB>brick=/bricks/b1<TAB>sync_jobs=4" + converted as "Config Change [{brick=/bricks/b1}, {sync_jobs=4}]" """ - msg = event + msgparts = [] for k, v in kwargs.items(): - msg += "\t{0}={1}".format(k, v) - return msg + msgparts.append("{%s=%s}" % (k, v)) + return "%s [%s]" % (event, ", ".join(msgparts)) class Popen(subprocess.Popen): |