# HG changeset patch
# User Bernd Schubert <[email protected]>
# Date 1289416214 -3600
# Node ID 9c93c2baad5829b711161dd811e6c83941a5fad0
# Parent  e3ed606d23eee5b31e498391ea6e0dd3b87dcdab
cl_log: Always print the common log entity to syslog messages

Pacemaker logs a lot of messages to system logs and always
with different entities. As different entities are difficult
to filter out with a generic rule, we always add the common
log entity for syslog messages. That allows to write a simple
filter rules

Signed-off-by: Bernd Schubert <[email protected]>

diff --git a/lib/clplumbing/cl_log.c b/lib/clplumbing/cl_log.c
--- a/lib/clplumbing/cl_log.c
+++ b/lib/clplumbing/cl_log.c
@@ -531,7 +531,7 @@ cl_direct_log(int priority, const char* 
        int     needprivs = !cl_have_full_privs();
 
        if (entity == NULL){
-               entity =cl_log_entity;
+               entity = cl_log_entity;
        }
        
        pristr = use_priority_str ? prio2str(priority) : "";
@@ -541,13 +541,10 @@ cl_direct_log(int priority, const char* 
        }
        
        if (syslog_enabled) {
-               if (entity) {
-                       strncpy(common_log_entity, entity, MAXENTITY);
-               } else {
-                       strncpy(common_log_entity, DFLT_ENTITY, MAXENTITY);
-               }
-
-               common_log_entity[MAXENTITY-1] = '\0';
+               if (!entity)
+                       entity = "";
+               snprintf(common_log_entity, MAXENTITY, "%s %s", 
+                        cl_log_entity, entity);
 
                syslog(priority, "[%d]: %s: %s%c",
                       entity_pid, pristr,  buf, 0);
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to