MINOR: log/applet: add new function syslog_applet_append_event()

This function takes a buffer on input, and offset and a length, and
consumes the block from that buffer to send it to the appctx's output
buffer. Contrary to its sibling applet_append_line(), instead of just
appending an LF at the end of the line, it prepends the message size
in decimal and a space before the message, as expected by syslog TCP
implementaions. This will be used to simplify the ring reader code.
This commit is contained in:
Willy Tarreau
2024-02-27 16:17:42 +01:00
parent 6ae41dc510
commit 201c706330
2 changed files with 37 additions and 0 deletions

View File

@@ -87,6 +87,8 @@ void app_log(struct list *loggers, struct buffer *tag, int level, const char *fo
*/
int add_to_logformat_list(char *start, char *end, int type, struct list *list_format, char **err);
ssize_t syslog_applet_append_event(void *ctx, const struct buffer *buf, size_t ofs, size_t len);
/*
* Parse the log_format string and fill a linked list.
* Variable name are preceded by % and composed by characters [a-zA-Z0-9]* : %varname