SM service logs are being duplicated into postgres.log

The logging configuration update for the SM service logs
is invalid and conflicts with the postgres logging
facility (local0), causing the SM logs to appear in
both sm-service.log and postgres.log. Reverting to
facility (local3) for SM service logs to fix the
issue and adding upgrade and rollback support for
the syslog changes introduced.
Change that introduced the bug - https://review.opendev.org/c/starlingx/ha/+/923772

Test Plan: Verified the changes on simplex and duplex configurations.

PASS: AIO-Simplex - Verified service logs are written to
                    sm-service.log.Verfied that service
                    logs are not seen in sm.log
                    and postgres.log
PASS: AIO-Duplex -  Verified service logs are written to
                    sm-service.log.
                    Verified that service logs are not in sm.log and
                    postgres.log
PASS: AIO-Duplex -  Verified that service logs are written to
                    sm-service.log file after a controlled swact and
                    not seen in sm.log and postgres.log
PASS: AIO-Duplex -  Verified that upgrade from 22.12 to 24.09 is
                    successful and the logs are written to
                    sm-services.log file
PASS: AIO-Duplex -  Verified that rollback from 24.09 to 22.12 is
                    successful and logs are written to sm.log file

Closes-Bug: 2083632
Change-Id: Ie7ac43335d40dbcbb965ba7820eb105e23ced392
Signed-off-by: Sandhya Kalisetty <sandhya.kalisetty@windriver.com>
This commit is contained in:
Sandhya Kalisetty
2025-01-22 17:25:48 -05:00
parent a6e53a5343
commit d72da06a44
3 changed files with 8 additions and 12 deletions

View File

@@ -28,7 +28,7 @@ typedef struct
{
bool inuse;
uint64_t log_seqnum;
u_int64_t service_log_seqnum;
uint64_t service_log_seqnum;
char thread_name[SM_THREAD_NAME_MAX_CHAR];
int thread_id;
char thread_identifier[SM_THREAD_NAME_MAX_CHAR+10];

View File

@@ -31,12 +31,6 @@
#define SM_SYSLOG( format, args... ) \
syslog( LOG_LOCAL3 | LOG_DEBUG, format "\n", ##args )
#define SM_WRITE_SYSLOG( format, args... ) \
syslog( LOG_LOCAL3 | LOG_DEBUG, format "\n", ##args )
#define SM_WRITE_SERVICELOG( format, args... ) \
syslog( LOG_LOCAL0 | LOG_DEBUG, format "\n", ##args )
#define SM_WRITE_SCHEDLOG( format, args... ) \
fprintf( _sched_log, format "\n", ##args ); \
fflush( _sched_log )
@@ -89,8 +83,8 @@ static void sm_debug_thread_dispatch( int selobj, int64_t user_data )
sm_time_get( &time_prev );
SM_WRITE_SYSLOG( "time[%ld.%03ld] log<%" PRIu64 "> %s",
(long) msg.u.log.ts_mono.tv_sec,
SM_SYSLOG( "time[%ld.%03ld] log<%" PRIu64 "> %s",
(long) msg.u.log.ts_mono.tv_sec,
(long) msg.u.log.ts_mono.tv_nsec/1000000,
msg.u.log.seqnum, msg.u.log.data );
@@ -132,7 +126,7 @@ static void sm_debug_thread_dispatch( int selobj, int64_t user_data )
sm_time_get( &time_prev );
SM_WRITE_SERVICELOG( "time[%ld.%03ld] log<%" PRIu64 "> %s",
SM_SYSLOG( "time[%ld.%03ld] sm_svc_log<%" PRIu64 "> %s",
(long) msg.u.log.ts_mono.tv_sec,
(long) msg.u.log.ts_mono.tv_nsec/1000000,
msg.u.log.seqnum, msg.u.log.data );

View File

@@ -1,9 +1,11 @@
#SM log filters
filter f_smsvc { facility(local0) and program(sm); };
filter f_smsvc { facility(local3) and match("sm_svc_log.*"); };
filter f_local3 { facility(local3) and not filter(f_smsvc); };
#SM log destinaions
destination d_smsvc { file("/var/log/sm-service.log"); };
destination d_sm { file("/var/log/sm.log"); };
#SM log paths
log { source(s_src); filter(f_smsvc); destination(d_smsvc); };
log { source(s_src); filter(f_local3); destination(d_sm); };