defaults.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. /** @file defaults.h
  3. * @brief Hard-coded configuration settings for the Logs Management engine
  4. */
  5. #ifndef LOGSMANAG_DEFAULTS_H_
  6. #define LOGSMANAG_DEFAULTS_H_
  7. /* -------------------------------------------------------------------------- */
  8. /* General */
  9. /* -------------------------------------------------------------------------- */
  10. #define KiB * 1024ULL
  11. #define MiB * 1048576ULL
  12. #define GiB * 1073741824ULL
  13. #define MAX_LOG_MSG_SIZE 50 MiB /**< Maximum allowable log message size (in Bytes) to be stored in message queue and DB. **/
  14. #define MAX_CUS_CHARTS_PER_SOURCE 100 /**< Hard limit of maximum custom charts per log source **/
  15. #define MAX_OUTPUTS_PER_SOURCE 100 /**< Hard limit of maximum Fluent Bit outputs per log source **/
  16. #define UPDATE_TIMEOUT_DEFAULT 10 /**< Default timeout to use to update charts if they haven't been updated in the meantime. **/
  17. #if !defined(LOGS_MANAGEMENT_DEV_MODE)
  18. #define ENABLE_COLLECTED_LOGS_TOTAL_DEFAULT CONFIG_BOOLEAN_NO /**< Default value to enable (or not) metrics of total collected log records **/
  19. #else
  20. #define ENABLE_COLLECTED_LOGS_TOTAL_DEFAULT CONFIG_BOOLEAN_YES /**< Default value to enable (or not) metrics of total collected log records, if stress tests are enabled **/
  21. #endif
  22. #define ENABLE_COLLECTED_LOGS_RATE_DEFAULT CONFIG_BOOLEAN_YES /**< Default value to enable (or not) metrics of rate of collected log records **/
  23. #define SD_JOURNAL_FIELD_PREFIX "LOGS_MANAG_" /**< Default systemd journal field prefix for sources that log to the system journal */
  24. #define SD_JOURNAL_SEND_DEFAULT CONFIG_BOOLEAN_NO /**< Default value to enable (or not) submission of logs to the system journal (where applicable) **/
  25. #define LOGS_MANAG_CHARTNAME_SIZE 50 /**< Maximum size of log source chart names, including terminating '\0'. **/
  26. #define LOGS_MANAG_CHARTNAME_PREFIX "logs_manag_" /**< Prefix of top-level chart names, used also in function sources. **/
  27. /* -------------------------------------------------------------------------- */
  28. /* -------------------------------------------------------------------------- */
  29. /* Database */
  30. /* -------------------------------------------------------------------------- */
  31. typedef enum {
  32. LOGS_MANAG_DB_MODE_FULL = 0,
  33. LOGS_MANAG_DB_MODE_NONE
  34. } logs_manag_db_mode_t;
  35. #define SAVE_BLOB_TO_DB_DEFAULT 6 /**< Global default configuration interval to save buffers from RAM to disk **/
  36. #define SAVE_BLOB_TO_DB_MIN 2 /**< Minimum allowed interval to save buffers from RAM to disk **/
  37. #define SAVE_BLOB_TO_DB_MAX 1800 /**< Maximum allowed interval to save buffers from RAM to disk **/
  38. #define BLOB_MAX_FILES 10 /**< Maximum allowed number of BLOB files (per collection) that are used to store compressed logs. When exceeded, the olderst one will be overwritten. **/
  39. #define DISK_SPACE_LIMIT_DEFAULT 500 /**< Global default configuration maximum database disk space limit per log source **/
  40. #if !defined(LOGS_MANAGEMENT_DEV_MODE)
  41. #define GLOBAL_DB_MODE_DEFAULT_STR "none" /**< db mode string to be used as global default in configuration **/
  42. #define GLOBAL_DB_MODE_DEFAULT LOGS_MANAG_DB_MODE_NONE /**< db mode to be used as global default, matching GLOBAL_DB_MODE_DEFAULT_STR **/
  43. #else
  44. #define GLOBAL_DB_MODE_DEFAULT_STR "full" /**< db mode string to be used as global default in configuration, if stress tests are enabled **/
  45. #define GLOBAL_DB_MODE_DEFAULT LOGS_MANAG_DB_MODE_FULL /**< db mode to be used as global default, matching GLOBAL_DB_MODE_DEFAULT_STR, if stress tests are enabled **/
  46. #endif
  47. /* -------------------------------------------------------------------------- */
  48. /* -------------------------------------------------------------------------- */
  49. /* Circular Buffer */
  50. /* -------------------------------------------------------------------------- */
  51. #define CIRCULAR_BUFF_SPARE_ITEMS_DEFAULT 2 /**< Additional circular buffers items to give time to the db engine to save buffers to disk **/
  52. #define CIRCULAR_BUFF_DEFAULT_MAX_SIZE (64 MiB) /**< Default circular_buffer_max_size **/
  53. #define CIRCULAR_BUFF_MAX_SIZE_RANGE_MIN (1 MiB) /**< circular_buffer_max_size read from configuration cannot be smaller than this **/
  54. #define CIRCULAR_BUFF_MAX_SIZE_RANGE_MAX (4 GiB) /**< circular_buffer_max_size read from configuration cannot be larger than this **/
  55. #define CIRCULAR_BUFF_DEFAULT_DROP_LOGS 0 /**< Global default configuration value whether to drop logs if circular buffer is full **/
  56. #define CIRC_BUFF_PREP_WR_RETRY_AFTER_MS 1000 /**< If circ_buff_prepare_write() fails due to not enough space, how many millisecs to wait before retrying **/
  57. /* -------------------------------------------------------------------------- */
  58. /* -------------------------------------------------------------------------- */
  59. /* Compression */
  60. /* -------------------------------------------------------------------------- */
  61. #define COMPRESSION_ACCELERATION_DEFAULT 1 /**< Global default value for compression acceleration **/
  62. /* -------------------------------------------------------------------------- */
  63. /* -------------------------------------------------------------------------- */
  64. /* Kernel logs (kmsg) plugin */
  65. /* -------------------------------------------------------------------------- */
  66. #define KERNEL_LOGS_COLLECT_INIT_WAIT 5 /**< Wait time (in sec) before kernel log collection starts. Required in order to skip collection and processing of pre-existing logs at Netdata boot. **/
  67. /* -------------------------------------------------------------------------- */
  68. /* -------------------------------------------------------------------------- */
  69. /* Fluent Bit */
  70. /* -------------------------------------------------------------------------- */
  71. #define FLB_FLUSH_DEFAULT "0.1" /**< Default Fluent Bit flush interval **/
  72. #define FLB_HTTP_LISTEN_DEFAULT "0.0.0.0" /**< Default Fluent Bit server listening socket **/
  73. #define FLB_HTTP_PORT_DEFAULT "2020" /**< Default Fluent Bit server listening port **/
  74. #define FLB_HTTP_SERVER_DEFAULT "false" /**< Default Fluent Bit server enable status **/
  75. #define FLB_LOG_FILENAME_DEFAULT "fluentbit.log" /**< Default Fluent Bit log filename **/
  76. #define FLB_LOG_LEVEL_DEFAULT "info" /**< Default Fluent Bit log level **/
  77. #define FLB_CORO_STACK_SIZE_DEFAULT "24576" /**< Default Fluent Bit coro stack size - do not change this value unless there is a good reason **/
  78. #define FLB_FORWARD_UNIX_PATH_DEFAULT "" /**< Default path for Forward unix socket configuration, see also https://docs.fluentbit.io/manual/pipeline/inputs/forward#configuration-parameters **/
  79. #define FLB_FORWARD_UNIX_PERM_DEFAULT "0644" /**< Default permissions for Forward unix socket configuration, see also https://docs.fluentbit.io/manual/pipeline/inputs/forward#configuration-parameters **/
  80. #define FLB_FORWARD_ADDR_DEFAULT "0.0.0.0" /**< Default listen address for Forward socket configuration, see also https://docs.fluentbit.io/manual/pipeline/inputs/forward#configuration-parameters **/
  81. #define FLB_FORWARD_PORT_DEFAULT "24224" /**< Default listen port for Forward socket configuration, see also https://docs.fluentbit.io/manual/pipeline/inputs/forward#configuration-parameters **/
  82. /* -------------------------------------------------------------------------- */
  83. /* -------------------------------------------------------------------------- */
  84. /* Queries */
  85. /* -------------------------------------------------------------------------- */
  86. #define LOGS_MANAG_MAX_COMPOUND_QUERY_SOURCES 10U /**< Maximum allowed number of log sources that can be searched in a single query **/
  87. #define LOGS_MANAG_QUERY_QUOTA_DEFAULT (10 MiB) /**< Default logs management query quota **/
  88. #define LOGS_MANAG_QUERY_QUOTA_MAX MAX_LOG_MSG_SIZE /**< Max logs management query quota **/
  89. #define LOGS_MANAG_QUERY_IGNORE_CASE_DEFAULT 0 /**< Boolean to indicate whether to ignore case for keyword or not **/
  90. #define LOGS_MANAG_QUERY_SANITIZE_KEYWORD_DEFAULT 0 /**< Boolean to indicate whether to sanitize keyword or not **/
  91. #define LOGS_MANAG_QUERY_TIMEOUT_DEFAULT 30 /**< Default timeout of logs management queries (in secs) **/
  92. /* -------------------------------------------------------------------------- */
  93. #endif // LOGSMANAG_DEFAULTS_H_