jcs
/subtext
/amendments
/586
logger: syslog doesn't need the hostname on the wire after all
jcs made amendment 586 9 months ago
--- logger.c Mon Feb 12 23:21:01 2024
+++ logger.c Tue Feb 13 08:48:34 2024
@@ -485,35 +485,7 @@ no_overflow:
logger->buffered_logs[0] = '\0';
}
-/* RFC3164 */
void
-syslog_vprintf(const char *format, va_list ap)
-{
- size_t len;
- time_t now = Time;
-
- if (!db->config.syslog_ip || syslog_send_buf == NULL)
- return;
-
- /* system (3) priority, notice (5) severity */
- len = strftime(syslog_send_buf, SYSLOG_SEND_BUF_SIZE,
- "<29>%b %d %H:%M:%S", localtime(&now));
- len += snprintf(syslog_send_buf + len, SYSLOG_SEND_BUF_SIZE - len,
- " %s subtext: ", db->config.hostname);
-
- len += vsnprintf(syslog_send_buf + len, SYSLOG_SEND_BUF_SIZE - len,
- format, ap);
-
- syslog_wds[0].ptr = (Ptr)syslog_send_buf;
- syslog_wds[0].length = len;
- syslog_wds[1].ptr = 0;
- syslog_wds[1].length = 0;
-
- _UDPSend(&syslog_pb, syslog_stream, syslog_wds,
- db->config.syslog_ip, 514, NULL, NULL, false);
-}
-
-void
syslog_init(void)
{
short error;
@@ -557,4 +529,29 @@ syslog_reinit(void)
{
syslog_deinit();
syslog_init();
-}
+}
+
+/* RFC3164 */
+void
+syslog_vprintf(const char *format, va_list ap)
+{
+ size_t len;
+ time_t now = Time;
+
+ if (!db->config.syslog_ip || syslog_send_buf == NULL)
+ return;
+
+ /* system (3) priority, notice (5) severity */
+ len = strftime(syslog_send_buf, SYSLOG_SEND_BUF_SIZE,
+ "<29>%b %d %H:%M:%S subtext: ", localtime(&now));
+ len += vsnprintf(syslog_send_buf + len, SYSLOG_SEND_BUF_SIZE - len,
+ format, ap);
+
+ syslog_wds[0].ptr = (Ptr)syslog_send_buf;
+ syslog_wds[0].length = len;
+ syslog_wds[1].ptr = 0;
+ syslog_wds[1].length = 0;
+
+ _UDPSend(&syslog_pb, syslog_stream, syslog_wds,
+ db->config.syslog_ip, 514, NULL, NULL, false);
+}