| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef NETDATA_ND_LOG_COMMON_H |
| 4 | #define NETDATA_ND_LOG_COMMON_H |
| 5 | |
| 6 | #include <syslog.h> |
| 7 | |
| 8 | typedef enum __attribute__((__packed__)) { |
| 9 | NDLS_UNSET = 0, // internal use only |
| 10 | NDLS_ACCESS, // access.log |
| 11 | NDLS_ACLK, // aclk.log |
| 12 | NDLS_COLLECTORS, // collector.log |
| 13 | NDLS_DAEMON, // error.log |
| 14 | NDLS_HEALTH, // health.log |
| 15 | NDLS_DEBUG, // debug.log |
| 16 | |
| 17 | // terminator |
| 18 | _NDLS_MAX, |
| 19 | } ND_LOG_SOURCES; |
| 20 | |
| 21 | typedef enum __attribute__((__packed__)) { |
| 22 | NDLP_EMERG = LOG_EMERG, // from syslog.h |
| 23 | NDLP_ALERT = LOG_ALERT, // from syslog.h |
| 24 | NDLP_CRIT = LOG_CRIT, // from syslog.h |
| 25 | NDLP_ERR = LOG_ERR, // from syslog.h |
| 26 | NDLP_WARNING = LOG_WARNING, // from syslog.h |
| 27 | NDLP_NOTICE = LOG_NOTICE, // from syslog.h |
| 28 | NDLP_INFO = LOG_INFO, // from syslog.h |
| 29 | NDLP_DEBUG = LOG_DEBUG, // from syslog.h |
| 30 | |
| 31 | // terminator |
| 32 | _NDLP_MAX, |
| 33 | } ND_LOG_FIELD_PRIORITY; |
| 34 | |
| 35 | typedef enum __attribute__((__packed__)) { |
| 36 | // KEEP THESE IN THE SAME ORDER AS in thread_log_fields (log.c) |
| 37 | // so that it easy to audit for missing fields |
| 38 | |
| 39 | // NEVER RENUMBER THIS LIST |
| 40 | // The Windows Events Log has them at fixed positions |
| 41 | |
| 42 | NDF_STOP = 0, |
| 43 | NDF_TIMESTAMP_REALTIME_USEC = 1, // the timestamp of the log message - added automatically |
| 44 | NDF_SYSLOG_IDENTIFIER = 2, // the syslog identifier of the application - added automatically |
| 45 | NDF_LOG_SOURCE = 3, // DAEMON, COLLECTORS, HEALTH, MSGID_ACCESS, ACLK - set at the log call |
| 46 | NDF_PRIORITY = 4, // the syslog priority (severity) - set at the log call |
| 47 | NDF_ERRNO = 5, // the ERRNO at the time of the log call - added automatically |
| 48 | NDF_WINERROR = 6, // Windows GetLastError() |
| 49 | NDF_INVOCATION_ID = 7, // the INVOCATION_ID of Netdata - added automatically |
| 50 | NDF_LINE = 8, // the source code file line number - added automatically |
| 51 | NDF_FILE = 9, // the source code filename - added automatically |
| 52 | NDF_FUNC = 10, // the source code function - added automatically |
| 53 | NDF_TID = 11, // the thread ID of the thread logging - added automatically |
| 54 | NDF_THREAD_TAG = 12, // the thread tag of the thread logging - added automatically |
| 55 | NDF_MESSAGE_ID = 13, // for specific events |
| 56 | NDF_MODULE = 14, // for internal plugin module, all other get the NDF_THREAD_TAG |
| 57 | |
| 58 | NDF_NIDL_NODE = 15, // the node / rrdhost currently being worked |
| 59 | NDF_NIDL_INSTANCE = 16, // the instance / rrdset currently being worked |
| 60 | NDF_NIDL_CONTEXT = 17, // the context of the instance currently being worked |
| 61 | NDF_NIDL_DIMENSION = 18, // the dimension / rrddim currently being worked |
| 62 | |
| 63 | // web server, aclk and stream receiver |
| 64 | NDF_SRC_TRANSPORT = 19, // the transport we received the request, one of: http, https, pluginsd |
| 65 | |
| 66 | // Netdata Cloud Related |
| 67 | NDF_ACCOUNT_ID = 20, |
| 68 | NDF_USER_NAME = 21, |
| 69 | NDF_USER_ROLE = 22, |
| 70 | NDF_USER_ACCESS = 23, |
| 71 | |
| 72 | // web server and stream receiver |
| 73 | NDF_SRC_IP = 24, // the streaming / web server source IP |
| 74 | NDF_SRC_PORT = 25, // the streaming / web server source Port |
| 75 | NDF_SRC_FORWARDED_HOST = 26, |
| 76 | NDF_SRC_FORWARDED_FOR = 27, |
| 77 | NDF_SRC_CAPABILITIES = 28, // the stream receiver capabilities |
| 78 | |
| 79 | // stream sender (established links) |
| 80 | NDF_DST_TRANSPORT = 29, // the transport we send the request, one of: http, https |
| 81 | NDF_DST_IP = 30, // the destination streaming IP |
| 82 | NDF_DST_PORT = 31, // the destination streaming Port |
| 83 | NDF_DST_CAPABILITIES = 32, // the destination streaming capabilities |
| 84 | |
| 85 | // web server, aclk and stream receiver |
| 86 | NDF_REQUEST_METHOD = 33, // for http like requests, the http request method |
| 87 | NDF_RESPONSE_CODE = 34, // for http like requests, the http response code, otherwise a status string |
| 88 | |
| 89 | // web server (all), aclk (queries) |
| 90 | NDF_CONNECTION_ID = 35, // the web server connection ID |
| 91 | NDF_TRANSACTION_ID = 36, // the web server and API transaction ID |
| 92 | NDF_RESPONSE_SENT_BYTES = 37, // for http like requests, the response bytes |
| 93 | NDF_RESPONSE_SIZE_BYTES = 38, // for http like requests, the uncompressed response size |
| 94 | NDF_RESPONSE_PREPARATION_TIME_USEC = 39, // for http like requests, the preparation time |
| 95 | NDF_RESPONSE_SENT_TIME_USEC = 40, // for http like requests, the time to send the response back |
| 96 | NDF_RESPONSE_TOTAL_TIME_USEC = 41, // for http like requests, the total time to complete the response |
| 97 | |
| 98 | // health alerts |
| 99 | NDF_ALERT_ID = 42, |
| 100 | NDF_ALERT_UNIQUE_ID = 43, |
| 101 | NDF_ALERT_EVENT_ID = 44, |
| 102 | NDF_ALERT_TRANSITION_ID = 45, |
| 103 | NDF_ALERT_CONFIG_HASH = 46, |
| 104 | NDF_ALERT_NAME = 47, |
| 105 | NDF_ALERT_CLASS = 48, |
| 106 | NDF_ALERT_COMPONENT = 49, |
| 107 | NDF_ALERT_TYPE = 50, |
| 108 | NDF_ALERT_EXEC = 51, |
| 109 | NDF_ALERT_RECIPIENT = 52, |
| 110 | NDF_ALERT_DURATION = 53, |
| 111 | NDF_ALERT_VALUE = 54, |
| 112 | NDF_ALERT_VALUE_OLD = 55, |
| 113 | NDF_ALERT_STATUS = 56, |
| 114 | NDF_ALERT_STATUS_OLD = 57, |
| 115 | NDF_ALERT_SOURCE = 58, |
| 116 | NDF_ALERT_UNITS = 59, |
| 117 | NDF_ALERT_SUMMARY = 60, |
| 118 | NDF_ALERT_INFO = 61, |
| 119 | NDF_ALERT_NOTIFICATION_REALTIME_USEC = 62, |
| 120 | NDF_REQUEST = 63, // the request we are currently working on |
| 121 | NDF_MESSAGE = 64, // the log message, if any |
| 122 | NDF_STACK_TRACE = 65, // stack trace of the thread logging |
| 123 | |
| 124 | // put new items here |
| 125 | // NEVER RENUMBER FIELDS - RENUMBERING BREAKS EXISTING WINDOWS MESSAGES |
| 126 | |
| 127 | // terminator |
| 128 | _NDF_MAX, |
| 129 | } ND_LOG_FIELD_ID; |
| 130 | |
| 131 | typedef enum __attribute__((__packed__)) { |
| 132 | NDFT_UNSET = 0, |
| 133 | NDFT_TXT, |
| 134 | NDFT_STR, |
| 135 | NDFT_BFR, |
| 136 | NDFT_U64, |
| 137 | NDFT_I64, |
| 138 | NDFT_DBL, |
| 139 | NDFT_UUID, |
| 140 | NDFT_CALLBACK, |
| 141 | |
| 142 | // terminator |
| 143 | _NDFT_MAX, |
| 144 | } ND_LOG_STACK_FIELD_TYPE; |
| 145 | |
| 146 | #endif //NETDATA_ND_LOG_COMMON_H |