diff --git a/src/collectors/systemd-journal.plugin/systemd-journal-annotations.c b/src/collectors/systemd-journal.plugin/systemd-journal-annotations.c index a72e57981c27e3..3ca10ab74a0e83 100644 --- a/src/collectors/systemd-journal.plugin/systemd-journal-annotations.c +++ b/src/collectors/systemd-journal.plugin/systemd-journal-annotations.c @@ -570,6 +570,9 @@ static void netdata_systemd_journal_message_ids_init(void) { msgid_into_dict("a8fa8dacdb1d443e9503b8be367a6adb", "SysV Service Found"); msgid_into_dict("187c62eb1e7f463bb530394f52cb090f", "Portable Service attached"); msgid_into_dict("76c5c754d628490d8ecba4c9d042112b", "Portable Service detached"); + msgid_into_dict("9cf56b8baf9546cf9478783a8de42113", "systemd-networkd sysctl changed by foreign process"); + msgid_into_dict("ad7089f928ac4f7ea00c07457d47ba8a", "SRK into TPM authorization failure"); + msgid_into_dict("b2bcbaf5edf948e093ce50bbea0e81ec", "Secure Attention Key (SAK) was pressed"); // dbus // https://github.com/bus1/dbus-broker/blob/main/src/catalog/catalog-ids.h @@ -606,12 +609,14 @@ static void netdata_systemd_journal_message_ids_init(void) { msgid_into_dict("dd11929c788e48bdbb6276fb5f26b08a", "Boltd starting"); // Netdata + msgid_into_dict("1e6061a9fbd44501b3ccc368119f2b69", "Netdata startup"); msgid_into_dict("ed4cdb8f1beb4ad3b57cb3cae2d162fa", "Netdata connection from child"); msgid_into_dict("6e2e3839067648968b646045dbf28d66", "Netdata connection to parent"); msgid_into_dict("9ce0cb58ab8b44df82c4bf1ad9ee22de", "Netdata alert transition"); msgid_into_dict("6db0018e83e34320ae2a659d78019fb7", "Netdata alert notification"); msgid_into_dict("23e93dfccbf64e11aac858b9410d8a82", "Netdata fatal message"); msgid_into_dict("8ddaf5ba33a74078b609250db1e951f3", "Sensor state transition"); + msgid_into_dict("ec87a56120d5431bace51e2fb8bba243", "Netdata log flood protection"); } void netdata_systemd_journal_transform_message_id(FACETS *facets __maybe_unused, BUFFER *wb, FACETS_TRANSFORMATION_SCOPE scope __maybe_unused, void *data __maybe_unused) { diff --git a/src/daemon/main.c b/src/daemon/main.c index 246ef8f92e9fb0..3e26b49d0af4bb 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -739,7 +739,15 @@ int netdata_main(int argc, char **argv) { // initialize the log files nd_log_initialize(); - netdata_log_info("Netdata agent version '%s' is starting", NETDATA_VERSION); + { + ND_LOG_STACK lgs[] = { + ND_LOG_FIELD_UUID(NDF_MESSAGE_ID, &netdata_startup_msgid), + ND_LOG_FIELD_END(), + }; + ND_LOG_STACK_PUSH(lgs); + + netdata_log_info("Netdata agent version '%s' is starting", NETDATA_VERSION); + } // ---------------------------------------------------------------------------------------------------------------- // global configuration diff --git a/src/libnetdata/log/nd_log-config.c b/src/libnetdata/log/nd_log-config.c index c8e17402e74dbc..a39c99b6d105f9 100644 --- a/src/libnetdata/log/nd_log-config.c +++ b/src/libnetdata/log/nd_log-config.c @@ -191,17 +191,19 @@ void nd_log_set_facility(const char *facility) { } void nd_log_set_flood_protection(size_t logs, time_t period) { - nd_log.sources[NDLS_DAEMON].limits.logs_per_period = - nd_log.sources[NDLS_DAEMON].limits.logs_per_period_backup; - nd_log.sources[NDLS_COLLECTORS].limits.logs_per_period = - nd_log.sources[NDLS_COLLECTORS].limits.logs_per_period_backup = logs; + // daemon logs + nd_log.sources[NDLS_DAEMON].limits.logs_per_period = logs; + nd_log.sources[NDLS_DAEMON].limits.logs_per_period_backup = logs; + nd_log.sources[NDLS_DAEMON].limits.throttle_period = period; - nd_log.sources[NDLS_DAEMON].limits.throttle_period = - nd_log.sources[NDLS_COLLECTORS].limits.throttle_period = period; + // collectors logs + nd_log.sources[NDLS_COLLECTORS].limits.logs_per_period = logs; + nd_log.sources[NDLS_COLLECTORS].limits.logs_per_period_backup = logs; + nd_log.sources[NDLS_COLLECTORS].limits.throttle_period = period; char buf[100]; - snprintfz(buf, sizeof(buf), "%" PRIu64, (uint64_t )period); + snprintfz(buf, sizeof(buf), "%" PRIu64, (uint64_t)period); nd_setenv("NETDATA_ERRORS_THROTTLE_PERIOD", buf, 1); - snprintfz(buf, sizeof(buf), "%" PRIu64, (uint64_t )logs); + snprintfz(buf, sizeof(buf), "%" PRIu64, (uint64_t)logs); nd_setenv("NETDATA_ERRORS_PER_PERIOD", buf, 1); } diff --git a/src/libnetdata/log/nd_log-internals.h b/src/libnetdata/log/nd_log-internals.h index 4038db8587dbec..aa27868a0fd7fe 100644 --- a/src/libnetdata/log/nd_log-internals.h +++ b/src/libnetdata/log/nd_log-internals.h @@ -107,6 +107,7 @@ struct nd_log_source { FILE *fp; ND_LOG_FIELD_PRIORITY min_priority; + const nd_uuid_t *pending_msgid; const char *pending_msg; struct nd_log_limit limits; diff --git a/src/libnetdata/log/nd_log.c b/src/libnetdata/log/nd_log.c index 35cdfe8badf49f..cbac15d19099b4 100644 --- a/src/libnetdata/log/nd_log.c +++ b/src/libnetdata/log/nd_log.c @@ -329,12 +329,19 @@ static void nd_logger(const char *file, const char *function, const unsigned lon .txt = nd_log.sources[source].pending_msg, }; + thread_log_fields[NDF_MESSAGE_ID].entry = (struct log_stack_entry){ + .set = nd_log.sources[source].pending_msgid != NULL, + .type = NDFT_UUID, + .uuid = nd_log.sources[source].pending_msgid, + }; + nd_logger_log_fields(spinlock, fp, false, priority, output, &nd_log.sources[source], thread_log_fields, THREAD_FIELDS_MAX); freez((void *)nd_log.sources[source].pending_msg); nd_log.sources[source].pending_msg = NULL; + nd_log.sources[source].pending_msgid = NULL; } errno_clear(); diff --git a/src/libnetdata/log/nd_log_limit.c b/src/libnetdata/log/nd_log_limit.c index 10ae2162d9f6d4..a9262ab00bdcc6 100644 --- a/src/libnetdata/log/nd_log_limit.c +++ b/src/libnetdata/log/nd_log_limit.c @@ -54,6 +54,7 @@ bool nd_log_limit_reached(struct nd_log_source *source) { freez((void *)source->pending_msg); source->pending_msg = strdupz(buffer_tostring(wb)); + source->pending_msgid = &log_flood_protection_msgid; buffer_free(wb); } @@ -84,6 +85,7 @@ bool nd_log_limit_reached(struct nd_log_source *source) { freez((void *)source->pending_msg); source->pending_msg = strdupz(buffer_tostring(wb)); + source->pending_msgid = &log_flood_protection_msgid; buffer_free(wb); } diff --git a/src/libnetdata/uuid/uuid.h b/src/libnetdata/uuid/uuid.h index 1f43873fd96b83..7437f9331bb41b 100644 --- a/src/libnetdata/uuid/uuid.h +++ b/src/libnetdata/uuid/uuid.h @@ -33,6 +33,8 @@ ND_UUID_DEFINE(health_alert_transition_msgid, 0x9c, 0xe0, 0xcb, 0x58, 0xab, 0x8b // this is also defined in alarm-notify.sh.in ND_UUID_DEFINE(health_alert_notification_msgid, 0x6d, 0xb0, 0x01, 0x8e, 0x83, 0xe3, 0x43, 0x20, 0xae, 0x2a, 0x65, 0x9d, 0x78, 0x01, 0x9f, 0xb7); ND_UUID_DEFINE(sensors_state_transition_msgid, 0x8d, 0xda, 0xf5, 0xba, 0x33, 0xa7, 0x40, 0x78, 0xb6, 0x09, 0x25, 0x0d, 0xb1, 0xe9, 0x51, 0xf3); +ND_UUID_DEFINE(log_flood_protection_msgid, 0xec, 0x87, 0xa5, 0x61, 0x20, 0xd5, 0x43, 0x1b, 0xac, 0xe5, 0x1e, 0x2f, 0xb8, 0xbb, 0xa2, 0x43); +ND_UUID_DEFINE(netdata_startup_msgid, 0x1e, 0x60, 0x61, 0xa9, 0xfb, 0xd4, 0x45, 0x01, 0xb3, 0xcc, 0xc3, 0x68, 0x11, 0x9f, 0x2b, 0x69); ND_UUID UUID_generate_from_hash(const void *payload, size_t payload_len);