Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
rsyslog.24024
0001-core-emit-TZ-warning-on-startup-not-on-Lin...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-core-emit-TZ-warning-on-startup-not-on-Linux-non-con.patch of Package rsyslog.24024
From d26343dc2fcfa4773da4e97e178ea3d94c3da120 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards <rgerhards@adiscon.com> Date: Mon, 17 Sep 2018 08:56:09 +0200 Subject: [PATCH] core: emit TZ warning on startup not on Linux non-container On Linux it seems common that the TZ variable is NOT properly set. There are some concerns that the warning related to rsyslog correcting this confuses users. It also seems that the corrective action rsyslog takes is right, and so there is no hard need to inform users on that. In Linux containers, however, the warning seems to be useful as the timezone setup there seems to be frequently-enough different and rsyslog's corrective action may not be correct. So we now check if we are running under Linux and not within a container. If so, we do not emit the warning. In all other case, we do. This is based on the assumption that other unixoid systems still should have TZ properly set. closes https://github.com/rsyslog/rsyslog/issues/2994 (cherry picked from commit 502759aea05abaf9a405278e4fe3c41a9c0edaeb) --- tools/rsyslogd.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tools/rsyslogd.c b/tools/rsyslogd.c index 4fad3ad5c..93308ac9b 100644 --- a/tools/rsyslogd.c +++ b/tools/rsyslogd.c @@ -61,6 +61,17 @@ #include "dirty.h" #include "janitor.h" +/* some global vars we need to differentiate between environments, + * for TZ-related things see + * https://github.com/rsyslog/rsyslog/issues/2994 + */ +static int runningInContainer = 0; +#ifdef OS_LINUX +static int emitTZWarning = 0; +#else +static int emitTZWarning = 1; +#endif + #if defined(_AIX) /* AIXPORT : start * The following includes and declarations are for support of the System @@ -1307,8 +1318,12 @@ initAll(int argc, char **argv) const char *const tz = (access("/etc/localtime", R_OK) == 0) ? "TZ=/etc/localtime" : "TZ=UTC"; putenv((char*)tz); - LogMsg(0, RS_RET_NO_TZ_SET, LOG_WARNING, "environment variable TZ is not " - "set, auto correcting this to %s\n", tz); + if(emitTZWarning) { + LogMsg(0, RS_RET_NO_TZ_SET, LOG_WARNING, "environment variable TZ is not " + "set, auto correcting this to %s", tz); + } else { + dbgprintf("environment variable TZ is not set, auto correcting this to %s\n", tz); + } } /* END core initializations - we now come back to carrying out command line options*/ @@ -1960,6 +1975,8 @@ main(int argc, char **argv) "terminate rsyslog\n", VERSION); PidFile = strdup("NONE"); /* disables pid file writing */ glblPermitCtlC = 1; + runningInContainer = 1; + emitTZWarning = 1; } else { /* "dynamic defaults" - non-container case */ PidFile = strdup(PATH_PIDFILE); -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor