[ovs-dev] [PATCH] vlog: extend syslog format to make OVS logs easier to filter
Romain Lenglet
rlenglet at vmware.com
Thu Apr 4 17:42:47 UTC 2013
Prepend "ovs|" to syslog logs to make them easier to filter out of all
LOG_DAEMON logs.
Signed-off-by: Romain Lenglet <rlenglet at vmware.com>
---
NEWS | 1 +
lib/vlog.h | 2 +-
python/ovs/vlog.py | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index cbbe06b..39e6e5d 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ post-v1.10.0
NXM fields.
- ovs-dpctl:
* New debugging commands "add-flow", "mod-flow", "del-flow".
+ - New syslog format, prefixed with "ovs|", to be easier to filter.
v1.10.0 - xx xxx xxxx
diff --git a/lib/vlog.h b/lib/vlog.h
index ab746c8..c7ab206 100644
--- a/lib/vlog.h
+++ b/lib/vlog.h
@@ -52,7 +52,7 @@ enum vlog_level vlog_get_level_val(const char *name);
/* Facilities that we can log to. */
#define VLOG_FACILITIES \
- VLOG_FACILITY(SYSLOG, "%05N|%c%T|%p|%m") \
+ VLOG_FACILITY(SYSLOG, "ovs|%05N|%c%T|%p|%m") \
VLOG_FACILITY(CONSOLE, "%D{%Y-%m-%dT%H:%M:%SZ}|%05N|%c%T|%p|%m") \
VLOG_FACILITY(FILE, "%D{%Y-%m-%dT%H:%M:%SZ}|%05N|%c%T|%p|%m")
enum vlog_facility {
diff --git a/python/ovs/vlog.py b/python/ovs/vlog.py
index 7cfa415..25ae4ea 100644
--- a/python/ovs/vlog.py
+++ b/python/ovs/vlog.py
@@ -71,7 +71,7 @@ class Vlog:
f_level = LEVELS.get(f_level, logging.CRITICAL)
if level >= f_level:
if f == "syslog":
- message = syslog_message
+ message = "ovs|" + syslog_message
else:
message = "%s|%s" % (now, syslog_message)
logging.getLogger(f).log(level, message, **kwargs)
--
1.8.1.3
More information about the dev
mailing list