Skip to content

Commit

Permalink
Klibs: syslog: use IMAGE_NAME environment variable as APP-NAME
Browse files Browse the repository at this point in the history
With this change, if the IMAGE_NAME environment variable is present
it is used to populate the APP_NAME field in syslog messages, while
the program name is used as a fallback.
  • Loading branch information
francescolavra committed Feb 9, 2022
1 parent cba8077 commit b7a4741
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion klib/syslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,10 @@ int init(status_handler complete)
}
if (syslog.server) {
syslog_server_resolve();
syslog.program = get(root, sym(program));
tuple env = get_environment();
syslog.program = get(env, sym(IMAGE_NAME));
if (!syslog.program)
syslog.program = get(root, sym(program));
syslog.max_hdr_len = 1 + sizeof(__XSTRING(SYSLOG_PRIORITY)) + sizeof(SYSLOG_VERSION) +
sizeof("YYYY-MM-ddThh:mm:ss.uuuuuuZ") + sizeof(syslog.local_ip) +
buffer_length(syslog.program) + 7;
Expand Down

0 comments on commit b7a4741

Please sign in to comment.