MEDIUM: logs: remove the hostname, tag and pid part from the logheader
At the moment we have to call snprintf() for every log line just to
rebuild a constant. Thanks to sendmsg(), we send the message in 3 parts:
time-based header, proxy-specific hostname+log-tag+pid, session-specific
message.
diff --git a/include/proto/log.h b/include/proto/log.h
index 14dfc5b..e8b57d8 100644
--- a/include/proto/log.h
+++ b/include/proto/log.h
@@ -138,6 +138,11 @@
*/
char *lf_port(char *dst, struct sockaddr *sockaddr, size_t size, struct logformat_node *node);
+/*
+ * Write hostname, log_tag and pid to the log string
+ */
+char *lf_host_tag_pid(char *dst, const char *hostname, const char *log_tag, int pid, size_t size);
+
#endif /* _PROTO_LOG_H */
diff --git a/include/types/log.h b/include/types/log.h
index 6707aa6..0214ae6 100644
--- a/include/types/log.h
+++ b/include/types/log.h
@@ -30,7 +30,7 @@
#define NB_LOG_FACILITIES 24
#define NB_LOG_LEVELS 8
-#define NB_MSG_IOVEC_ELEMENTS 2
+#define NB_MSG_IOVEC_ELEMENTS 3
#define SYSLOG_PORT 514
#define UNIQUEID_LEN 128
diff --git a/include/types/proxy.h b/include/types/proxy.h
index 170e6f7..1400126 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -346,6 +346,7 @@
struct list logsrvs;
struct list logformat; /* log_format linked list */
char *log_tag; /* override default syslog tag */
+ struct chunk log_htp; /* a syslog header part that contains hostname, log_tag and pid */
char *header_unique_id; /* unique-id header */
struct list format_unique_id; /* unique-id format */
int to_log; /* things to be logged (LW_*) */