summaryrefslogtreecommitdiffstats
path: root/syslogd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2005-08-17 10:53:43 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2005-08-17 10:53:43 +0000
commit9dda1cc11b6833fc8be869b950b04c598a83f964 (patch)
tree68d102571f3cc5c18805a2649d14d7948bb6b25e /syslogd.c
parent34a042a1052c4cd518842681a213660c0ba3b08c (diff)
downloadrsyslog-9dda1cc11b6833fc8be869b950b04c598a83f964.tar.gz
rsyslog-9dda1cc11b6833fc8be869b950b04c598a83f964.tar.xz
rsyslog-9dda1cc11b6833fc8be869b950b04c598a83f964.zip
improved rsyslogd startup and shutdown messages
Diffstat (limited to 'syslogd.c')
-rw-r--r--syslogd.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/syslogd.c b/syslogd.c
index 00362a0e..a460ada2 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -257,6 +257,7 @@ char ctty[] = _PATH_CONSOLE;
char **parts;
int inetm = 0;
+pid_t myPid; /* our pid for use in self-generated messages, e.g. on startup */
static int debugging_on = 0;
static int nlogs = -1;
static int restart = 0;
@@ -2335,6 +2336,7 @@ int main(argc, argv)
}
} /* if ( !Debug ) */
#endif
+ myPid = getpid(); /* save our pid for further testing (also used for messages) */
/* initialize the default templates
* we use template names with a SP in front - these
@@ -2430,7 +2432,7 @@ int main(argc, argv)
/*
* Send a signal to the parent to it can terminate.
*/
- if (getpid() != ppid)
+ if (myPid != ppid)
kill (ppid, SIGTERM);
#endif
@@ -4195,7 +4197,7 @@ void die(sig)
{
register struct filed *f;
- char buf[100];
+ char buf[256];
int lognum;
int i;
int was_initialized = Initialized;
@@ -4219,7 +4221,10 @@ void die(sig)
* filed structure still intact (initialized) for the below! */
if (sig) {
dprintf("rsyslogd: exiting on signal %d\n", sig);
- (void) snprintf(buf, sizeof(buf), "rsyslogd: exiting on signal %d", sig);
+ (void) snprintf(buf, sizeof(buf) / sizeof(char),
+ "rsyslogd: [origin software=\"rsyslogd\" " "swVersion=\"" VERSION "." \
+ PATCHLEVEL "\" x-pid=\"%d\"]" " exiting on signal %d.",
+ myPid, sig);
errno = 0;
logmsgInternal(LOG_SYSLOG|LOG_INFO, buf, LocalHostName, ADDDATE);
}
@@ -4399,6 +4404,7 @@ void init()
char cline[BUFSIZ];
#endif
struct servent *sp;
+ char bufStartUpMsg[512];
nextp = NULL;
if(LogPort == 0) {
@@ -4635,15 +4641,21 @@ void init()
ochPrintList();
}
- if ( AcceptRemote )
- logmsgInternal(LOG_SYSLOG|LOG_INFO, "rsyslogd: [origin software=\"rsyslogd\" " \
- "swVersion=\"" VERSION "." PATCHLEVEL "\"]" \
- " restart (remote reception)." , LocalHostName, \
- ADDDATE);
- else
- logmsgInternal(LOG_SYSLOG|LOG_INFO, "rsyslogd: [origin software=\"rsyslogd\" " \
- "swVersion=\"" VERSION "." PATCHLEVEL "\"]" \
- " restart." , LocalHostName, ADDDATE);
+ /* we now generate the startup message. It now includes everything to
+ * identify this instance.
+ * rgerhards, 2005-08-17
+ */
+ snprintf(bufStartUpMsg, sizeof(bufStartUpMsg)/sizeof(char),
+ "rsyslogd: [origin software=\"rsyslogd\" " "swVersion=\"" VERSION "." \
+ PATCHLEVEL "\" x-pid=\"%d\"][x-configInfo udpReception=\"%s\" " \
+ "udpPort=\"%d\" tcpReception=\"%s\" tcpPort=\"%d\"]" \
+ " restart",
+ myPid,
+ AcceptRemote ? "Yes" : "No", LogPort,
+ bEnableTCP ? "Yes" : "No", TCPLstnPort );
+ //AcceptRemote ? "(remote recpetion)" : "");
+ logmsgInternal(LOG_SYSLOG|LOG_INFO, bufStartUpMsg, LocalHostName, ADDDATE);
+
(void) signal(SIGHUP, sighup_handler);
dprintf("rsyslogd: restarted.\n");
}