[core, mod_console, mod_graylog2] Add sequence to logs to preserve order when timestamp is not precise enough.

This commit is contained in:
Chris Rienzo authored and Andrey Volk committed 2021-10-23 22:00:34 +03:00
1 parent cd041b768c
commit 2c3dcbde71
4 files changed
+14 -1

No files matched your search

+4 -1
View File
@@ -77,7 +77,8 @@ static switch_log_json_format_t json_format = {
{ "message", NULL }, // full_message
{ NULL, NULL }, // short_message
"", // custom_field_prefix
0.0 // timestamp_divisor
0.0, // timestamp_divisor
{ "sequence", NULL } // sequence
};
static char *to_json_string(const switch_log_node_t *node)
@@ -177,6 +178,8 @@ static switch_status_t config_logger(void)
json_format.full_message.name = zstr(val) ? NULL : switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "short-message")) {
json_format.short_message.name = zstr(val) ? NULL : switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "sequence")) {
json_format.sequence.name = zstr(val) ? NULL : switch_core_strdup(module_pool, val);
}
}
for (param = switch_xml_child(settings, "config"); param; param = param->next) {
@@ -333,6 +333,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_graylog2_load)
globals.gelf_format.full_message.name = "full_message";
globals.gelf_format.short_message.name = "short_message";
globals.gelf_format.custom_field_prefix = "_";
globals.gelf_format.sequence.name = "_sequence";
switch_event_create_plain(&globals.session_fields, SWITCH_EVENT_CHANNEL_DATA);