Skip to content

Commit

Permalink
Logs Management (netdata#13291)
Browse files Browse the repository at this point in the history
This PR adds the logs-management external plugin. 
See the included README for an extensive list of features. 
-------------------------------------------------------------------------------------

* Add proper status return in JSON response of functions

* Add column info to functions

* Escape special characters when returning JSON response

* Add proper functions help and defaults. Fix help not working

* Add 'logs_management_meta' object in functions results

* Fix compiler warnings

* Replace tabs with 3 spaces in web_client_api_request_v1_logsmanagement_sources()

* Add 'sources' in functions to display list of log sources

* Update functions column values for logs

* Update chart titles and remove '/s' from units

* Add support for compound queries in circular buffers

* Refactor circ_buff_search() to get rid of circ_buff_search_compound()

* Fix incorrect docker events nano timestamp padding

* Fixed botched rebasing

* Replace get_unix_time_ms() with now_realtime_msec()

* Remove binary generation from Fluent-Bit lib build

* Fix compiler warnings due to new timestamp type

* Remove STDIN and STDOUT support from Fluent-Bit library

* Initial support for FLB_KMSG kernel logs collection

* Add kernel logs charts

* Add kernel logs subsystem and device charts

* Skip collection of pre-existing logs in kmsg ring buffer

* Add example of custom kmsg charts

* Add extra initialization error logs

* Fix bug of Docker Events collector failure disabling whole logs management engine

* Remove reduntant FLB output code

* Remove some obsolete TODO comments

* Remove some commented out error/debug prints

* Disable some Fluent-Bit config options not required

* Make circular buffer spare items option configurable

* Add DB mode configuration option

* Replace p_file_infos_arr->data[i] with p_file_info in db_api.c

* Remove db_loop due to all function calls being synchronous

* Add initial README.md

* Add DB mode = none changes

* Add a simple webpage to visualize log query results

* Add support for source selection to logs_query.html

* Add option to query multiple log sources

* Mark non-queryable sources as such in logs_query.html

* Add option to use either GET or functions request in logs_query.html

* Install logs_query.html when running stress tests

* Update README.md requirements

* Change installer behavior to build logs management by default

* Disable logs management at runtime by default

* Add global db mode configuration in 'logs management' config section

* Split logsmanagement.conf into required & optional sections

* Remove --enable-logsmanagement from stress test script

* Add global config option for 'circular buffer max size MiB'

* Add global config option for 'circular buffer drop logs if full'

* Update 'General Configuration' in README.md

* Add global config option for remaining optional settings

* Add systemd collector requirements to TOC

* README: Convert general configuration to table

* README: Fix previous botched commit

* Enable logs management by default when building for stress testing

* Move logging to collector.log from error.log

* Fix contenttype compilation errors

* Move logging to collector.log in plugin_logsmanagement.c

* Rename 'rows' to 'records' in charts

* Add Netdata error.log parsing

* Add more dashboard descriptions

* Sanitize chart ids

* Attempt to fix failing CI

* Update README.md

* Update README.md

* Another attempt to fix CI failures

* Fix undefined reference to 'uv_sleep' on certain platforms

* Support FLB forward input and FLB output plugins.

Squashed commit of the following:

commit 55e2bf4
Author: Dim-P <[email protected]>
Date:   Thu Apr 13 16:41:09 2023 +0300

    Remove error.log from stock config

commit bbdc62c
Author: Dim-P <[email protected]>
Date:   Thu Apr 13 16:37:48 2023 +0300

    Add cleanup of Fluent Bit outputs in p_file_info_destroy()

commit 09b0aa4
Author: Dim-P <[email protected]>
Date:   Thu Apr 13 14:34:17 2023 +0300

    Some code and config cleanup

commit 030d074
Author: Dim-P <[email protected]>
Date:   Thu Apr 13 13:04:08 2023 +0300

    Enable additional Fluent Bit output plugins for shared library

commit 490aa5d
Author: Dim-P <[email protected]>
Date:   Thu Apr 13 01:33:19 2023 +0300

    Add initialization of Fluent Bit user-configured outputs

commit c96e9fe
Author: Dim-P <[email protected]>
Date:   Tue Apr 4 23:13:16 2023 +0100

    Complete read of parameters for FLB outputs config

commit 0098889
Author: Dim-P <[email protected]>
Date:   Mon Apr 3 19:43:31 2023 +0100

    Update README.md

commit 6deea53
Author: Dim-P <[email protected]>
Date:   Mon Apr 3 16:02:28 2023 +0100

    Refactor Syslog_parser_config_t and add Flb_socket_config_t

commit 7bf998a
Author: Dim-P <[email protected]>
Date:   Mon Apr 3 14:19:57 2023 +0100

    Update README.md

commit c353d19
Author: Dim-P <[email protected]>
Date:   Fri Mar 31 14:52:57 2023 +0100

    Update README.md

commit 6be726e
Author: Dim-P <[email protected]>
Date:   Fri Mar 31 13:06:29 2023 +0100

    Update README. Fix docker_events streaming

commit 6aabfb0
Author: Dim-P <[email protected]>
Date:   Thu Mar 30 21:27:45 2023 +0100

    Fix stuck in infinite loop bug for FLB_GENERIC, FLB_WEB_LOG and FLB_SERIAL remote log sources

commit eea6346
Author: Dim-P <[email protected]>
Date:   Thu Mar 30 21:04:12 2023 +0100

    Remove callback that searches for streamed p_file_info match

commit bc9c5a5
Author: Dim-P <[email protected]>
Date:   Thu Mar 30 15:51:39 2023 +0100

    Basic streaming works

commit 4c80f59
Author: Dim-P <[email protected]>
Date:   Tue Mar 28 22:05:22 2023 +0100

    WIP

commit eeb37a7
Author: Dim-P <[email protected]>
Date:   Mon Mar 27 22:52:09 2023 +0100

    Add generic forward streaming input

commit 1459b91
Author: Dim-P <[email protected]>
Date:   Thu Mar 23 18:50:14 2023 +0000

    FLB_FORWARD: WIP

* Add number of logs per item in DB and in queries response

* Fix wrong number of lines stored in DB for web logs

* Refactor number of logs parsers and charts code

* Add option to toggle number of collected logs metrics and charts

* Disable kmsg log collector by default

* Fix logs_query.html to work with any server ip

* Fix regressed wrong number of web log lines bug

* Change query quota type from size_t to long long

* Update alpine version when searching for fts-dev requirements

* Update query results to return both requested and actual quota

* Fix bug of circ buffs not being read if head == read but not empty

* Squashed commit of the following:

commit 34edb31
Author: Dim-P <[email protected]>
Date:   Thu May 4 20:02:36 2023 +0100

    Comment out some debug prints

commit 51b9b87
Author: Dim-P <[email protected]>
Date:   Fri Apr 28 19:21:54 2023 +0100

    Fix wrong filenames in BLOBS_TABLE after rotation

commit 6055fc2
Author: Dim-P <[email protected]>
Date:   Fri Apr 28 12:22:04 2023 +0100

    Add chart showing number of circular buffer items

commit 0bb5210
Author: Dim-P <[email protected]>
Date:   Tue Apr 25 16:47:29 2023 +0300

    Various fixes.

    Fix num_lines calculation.
    Add debug prints for circ buffers.
    Remove circ buff spare items option.
    Fix calculation of circ buff memory consumption.
    Add buff_realloc_rwlock for db_mode = none case.
    Fix circ buff read to be done correctly when buff is full.

commit f494af8
Author: Dim-P <[email protected]>
Date:   Fri Apr 21 16:03:50 2023 +0300

    Fix freez() on non-malloced address

commit cce6d09
Author: Dim-P <[email protected]>
Date:   Fri Apr 21 15:41:25 2023 +0300

    Add option to dynamically expand circ buffs when full

* Use log timestamps when possible, instead of collection timestamps.
Also, add config options for Fluent Bit engine and remove tail_plugin.

Squashed commit of the following:

commit b16a02e
Author: Dim-P <[email protected]>
Date:   Tue May 16 19:38:57 2023 +0100

    Add Fluent Bit service config options to netdata.conf. Add monitoring of new log file fluentbit.log

commit ab77c28
Author: Dim-P <[email protected]>
Date:   Mon May 15 21:25:17 2023 +0100

    Remove some debug prints

commit 46d64ad
Author: Dim-P <[email protected]>
Date:   Mon May 15 21:19:32 2023 +0100

    Fix null values in charts

commit 8ec9682
Author: Dim-P <[email protected]>
Date:   Mon May 15 17:43:04 2023 +0100

    Update README.md to reflect log timestamp changes

commit 079a918
Author: Dim-P <[email protected]>
Date:   Mon May 15 16:23:14 2023 +0100

    Add configurable option for 'update timeout'

commit 72b5e25
Author: Dim-P <[email protected]>
Date:   Mon May 15 16:05:08 2023 +0100

    Revert logsmanagement.conf to logs-manag-master one

commit 70d0ea6
Author: Dim-P <[email protected]>
Date:   Mon May 15 16:02:00 2023 +0100

    Fix bug of circ buff items not marked as done

commit 5716420
Author: Dim-P <[email protected]>
Date:   Mon May 15 16:01:41 2023 +0100

    Fix do_custom_charts_update() to work for all log sources

commit a8def8f
Author: Dim-P <[email protected]>
Date:   Fri May 12 18:20:20 2023 +0100

    Remove GENERIC and WEB_LOG cases. Remove tail_plugin.c/h. Remove generic_parser().

commit 1cf0596
Author: Dim-P <[email protected]>
Date:   Fri May 12 16:54:59 2023 +0100

    Fix FLB_GENERIC and FLB_SERIAL to work with new timestamp logic

commit df32668
Author: Dim-P <[email protected]>
Date:   Fri May 12 14:55:04 2023 +0100

    Get rid of *_collect() functions and restructure plugin_logsmanagement workers

commit 3eee069
Author: Dim-P <[email protected]>
Date:   Fri May 12 14:28:33 2023 +0100

    Fix wrong order of #define _XOPEN_SOURCE 700 in parser.c

commit 941aa80
Author: Dim-P <[email protected]>
Date:   Thu May 11 22:27:39 2023 +0100

    Update plugin_logsmanagement_web_log to use new timestamp logic and to support delayed logs. Refactor req_method metrics code.

commit 427a7d0
Author: Dim-P <[email protected]>
Date:   Tue May 9 20:26:08 2023 +0100

    Update plugin_logsmanagement_kernel to use new timestamp logic and to support delayed charts

commit a7e95a6
Author: Dim-P <[email protected]>
Date:   Tue May 9 15:22:14 2023 +0100

    Update plugin_logsmanagement_systemd to use new timestamp logic and support delayed charts

commit 48237ac
Author: Dim-P <[email protected]>
Date:   Tue May 9 13:29:44 2023 +0100

    Refactor number of collected logs chart update code

commit a933c8f
Author: Dim-P <[email protected]>
Date:   Mon May 8 22:11:19 2023 +0100

    Update plugin_logsmanagement_docker_ev to use new timestamp logic and support delayed charts

commit 5d8db05
Author: Dim-P <[email protected]>
Date:   Fri May 5 15:18:06 2023 +0100

    Change some Fluent Bit collectors to use log timestamps instead of collection timestamps

* Remove some unused defines and typedefs

* Improve flb_init()

* Update file-level doxygen. Add SPDX license declaration.

* Better handling of termination of Fluent Bit

* Better handling of DB errors. Various fixes.

Squashed commit of the following:

commit f55feea
Author: Dim-P <[email protected]>
Date:   Tue Jun 6 13:28:00 2023 +0100

    Fix web log parsing in case of lines terminated by \r

commit 9e05758
Author: Dim-P <[email protected]>
Date:   Mon Jun 5 20:42:05 2023 +0100

    Fix warnings due to -Wformat-truncation=2

commit 6347766
Author: Dim-P <[email protected]>
Date:   Mon Jun 5 16:48:45 2023 +0100

    Autodiscovery of Netdata error.log based on netdata_configured_log_dir

commit cab5e6d
Author: Dim-P <[email protected]>
Date:   Mon Jun 5 16:24:39 2023 +0100

    Replace Forward config default string literals with macros

commit 4213398
Author: Dim-P <[email protected]>
Date:   Mon Jun 5 15:56:29 2023 +0100

    Proper cleanup of flb_lib_out_cb *callback in case of error

commit f76fd7c
Author: Dim-P <[email protected]>
Date:   Mon Jun 5 15:36:07 2023 +0100

    Proper termination of Forward input and respective log sources in case of error

commit 3739fd9
Author: Dim-P <[email protected]>
Date:   Thu Jun 1 21:19:56 2023 +0100

    Merge db_search() and db_search_compound()

commit fcface9
Author: Dim-P <[email protected]>
Date:   Thu Jun 1 19:17:26 2023 +0100

    Proper error handling in db_search() and db_search_compound(). Refactor the code too.

commit c10667e
Author: Dim-P <[email protected]>
Date:   Thu Jun 1 14:23:34 2023 +0100

    Update DB mode and dir when switching to db_mode_none

commit d37d4c3
Author: Dim-P <[email protected]>
Date:   Thu Jun 1 12:56:13 2023 +0100

    Fix flb_stop() SIGSEGV

commit 892e231
Author: Dim-P <[email protected]>
Date:   Tue May 30 21:14:58 2023 +0100

    Switch to db_writer_db_mode_none if db_writer_db_mode_full encounters error

commit f7a0c21
Author: Dim-P <[email protected]>
Date:   Mon May 29 21:41:21 2023 +0100

    Complete error handling changes to db_init(). Add some const type qualifiers. Refactor some code for readability

commit 13dbeac
Author: Dim-P <[email protected]>
Date:   Mon May 29 17:14:17 2023 +0100

    More error handling changes in db_init(). Change some global default settings if stress testing.

commit eb0691c
Author: Dim-P <[email protected]>
Date:   Fri May 26 23:29:12 2023 +0100

    Better handling of db writer threads errors. Add db timings charts

* Fix mystrsep() replaced by strsep_skip_consecutive_separators()

* Fix older GCC failure due to label before declaration

* Fix failed builds when using libuv <= v1.19

* Fix some Codacy warnings

* Fix warning: implicit declaration of function ‘strsep’

* Use USEC_PER_SEC instead of 1000000ULL

* Use UUID_STR_LEN instead of GUID_LEN + 1

* Combine multiple 'ln -sf' Docker instructions to one

* Update README with systemd development libraries requirement

* Comment out mallocz() success checkes in parser_csv()

* Fix shellcheck warnings

* Remove asserts for empty SYSLOG_IDENTIFIER or PID

* Fix FreeBSD failing builds

* Fix some more shellcheck warnings

* Update Alpine fts-dev required packages

* First changes to use web log timestamp for correct metrics timings

* Initial work to add test_parse_web_log_line() unit test

* Complete test_parse_web_log_line() tests

* Improve parse_web_log_line() for better handling of \n, \r, double quotes etc.

* Fix 'Invalid TIME error when timezone sign is negative

* Add more logs to compression unit test case

* Misc read_last_line() improvements

* Fix failing test_auto_detect_web_log_parser_config() when test case terminated without '\n'

* Remove unused preprocessor macro

* Factor out setup of parse_config_expected_num_fields

* Add test for count_fields()

* Add unit test for read_last_line()

* Fix a read_last_line() bug

* Remove PLUGIN[logsmanagement] static thread and update charts synchronously, right before data buffering

* Fix web log parser potential SIGSEGV

* Fix web log metrics bug where they could show delayed by 1 collection interval

* WIP: Add multiline support to kmsg logs and fix metric timings

* Fix kmsg subsystem and device parsing and metrics

* Add option 'use log timestamp' to select between log timestamps or collection timestamps

* Add 'Getting Started' docs section

* Move logs management functions code to separate source files

* Add 'Nginx access.log' chart description

* Remove logsmanagement.plugin source files

* Fix some memory leaks

* Improve cleanup of logsmanagement_main()

* Fix a potential memory leak of fwd_input_out_cb

* Better termination and cleanup of main_loop and its handles

* Fix main_db_dir access() check bug

* Avoid uv_walk() SIGSEGV

* Remove main_db_dir access() check

* Better termination and cleanup of DB code

* Remove flb_socket_config_destroy() that could cause a segmentation fault

* Disable unique client IPs - all-time chart by default

* Update README.md

* Fix debug() -> netdata_log_debug()

* Fix read_last_line()

* Fix timestamp sign adjustment and wrong unit tests

* Change WEB_CLIENT_ACL_DASHBOARD to WEB_CLIENT_ACL_DASHBOARD_ACLK_WEBRTC

* Do not parse web log timestamps if 'use_log_timestamp = no'

* Add Logs Management back into buildinfo.c

* Update README.md

* Do not build Fluent Bit executable binary

* Change logs rate chart to RRDSET_TYPE_LINE

* Add kludge to prevent metrics breaking due to out of order logs

* Fix wrong flb_tmp_buff_cpy_timer expiration

* Refactor initialization of input plugin for local log sources.

* Rename FLB_GENERIC collector to FLB_TAIL.

* Switch 'Netdata fluentbit.log' to disabled by default

* Add 'use inotify' configuration option

* Update  in README.md

* Add docker event actions metrics

* Update README.md to include event action chart

* Remove commented out PLUGIN[logsmanagement] code block

* Fix some warnings

* Add documentation for outgoing log streaming and exporting

* Fix some code block formatting in README.md

* Refactor code related to error status of log query results and add new invalid timestamp case

* Reduce query mem allocs and fix end timestamp == 0 bug

* Add support for duplicate timestamps in db_search()

* Add support for duplicate timestamps in circ_buff_search()

* Fix docker events contexts

* Various query fixes prior to reverse order search.

- Add reverse qsort() function in circ buffers.
- Fix issues to properly support of duplicate timestamps.
- Separate requested from actual timestamps in query parameters.
- Rename results buffer variable name to be consistent between DB and
  buffers.
- Remove default start and end timestamp from functions.
- Improve handling of invalid quotas provided by users.
- Rename 'until' timestamp name to 'to'.
- Increase default quota to 10MB from 1MB.
- Allow start timestamp to be > than end timestamp.

* Complete descending timestamp search for circular buffers

* Complete descending timestamp search for DB

* Remove MEASURE_QUERY_TIME code block

* Complete descending timestamp search when data resides in both DB and circular buffers

* Use pointer instead of copying res_hdr in query results

* Refactor web log timezone parsing to use static memory allocation

* Add stats for CPU user & system time per MiB of query results

* Micro-optimization to slightly speed up queries

* More micro-optimizations and some code cleanup

* Remove LOGS_QUERY_DATA_FORMAT_NEW_LINE option

* Escape iscntrl() chars at collection rather at query

* Reduce number of buffer_strcat() calls

* Complete descending timestamp order queries for web_api_v1

* Complete descending timestamp order queries for functions

* Fix functions query timings to match web_api_v1 ones

* Add MQTT message collector

Squashed commit of the following:

commit dbe5153
Author: Dim-P <[email protected]>
Date:   Mon Aug 21 15:18:46 2023 +0100

    Update README.md with MQTT information

commit c0b5dbc
Author: Dim-P <[email protected]>
Date:   Mon Aug 21 14:59:36 2023 +0100

    Tidy up before merge

commit 9a69c4f
Author: Dim-P <[email protected]>
Date:   Mon Aug 21 12:54:33 2023 +0100

    Fix issue with duplicate Log_Source_Path in DB, introduced in commit e417af3

commit 48213e9
Author: Dim-P <[email protected]>
Date:   Sat Aug 19 05:05:36 2023 +0100

    WIP

commit e417af3
Author: Dim-P <[email protected]>
Date:   Thu Aug 17 18:03:39 2023 +0100

    Update functions logsmanagement help output

* Inhibit Fluent Bit build warnings

* Fix missing allow_subpaths value in api_commands_v1[].

* Fix missing HTTP_RESP_BACKEND_FETCH_FAILED error

* Fix an enum print warning

* Remove systemd-devel requirement from README and fix codacy warnings

* Update Alpine versions for musl-fts-dev

* Update Fluent Bit to v2.1.8

Squashed commit of the following:

commit faf6fc4
Author: Dim-P <[email protected]>
Date:   Fri Aug 25 17:13:30 2023 +0100

    Fix wrong default CORE_STACK_SIZE on Alpine

commit a810238
Author: Dim-P <[email protected]>
Date:   Fri Aug 25 00:40:02 2023 +0100

    Update Fluent Bit patches for musl

commit 8bed3b6
Author: Dim-P <[email protected]>
Date:   Thu Aug 24 21:54:38 2023 +0100

    Fix an edge case crash when web log method is '-'

commit b29b48e
Author: Dim-P <[email protected]>
Date:   Thu Aug 24 16:26:13 2023 +0100

    Disable FLB_OUT_CALYPTIA to fix Alpine dlsym() error

commit eabe0d0
Author: Dim-P <[email protected]>
Date:   Tue Aug 22 21:25:54 2023 +0100

    Add 'use inotify = no' troubleshooting Q&A in README

commit 7f7ae85
Author: Dim-P <[email protected]>
Date:   Tue Aug 22 18:06:36 2023 +0100

    Update README.md links to latest version

commit 610c5ac
Author: Dim-P <[email protected]>
Date:   Tue Aug 22 16:23:30 2023 +0100

    Update flb_parser_create() definition

commit f99608f
Author: Dim-P <[email protected]>
Date:   Tue Aug 22 16:23:04 2023 +0100

    Add new config.cmake options

commit 446b0d5
Author: Dim-P <[email protected]>
Date:   Tue Aug 22 12:21:25 2023 +0100

    Update Fluent Bit submodule to v2.1.8

* Add logs_management_unittest() to CI 'unittest'

* Remove obsolete query testing files

* Patch Fluent Bit log format to match netdata's format

* Update README with instructions on how to monitor Podman events logs

* Fix core dump in case of flb_lib_path dlopen()

* Fix some potential compiler warnings

* Fix queries crash if logs manag engine not running

* Much faster termination of LOGS MANAGEMENT

* Add facets support and other minor fixes.

logsmanagement_function_execute_cb() is replaced by
logsmanagement_function_facets() which adds facets support to logs
management queries.

Internal query results header now includes additional fields
(log_source, log_type, basename, filename, chartname), that are used as facets.

Queries now support timeout as a query parameter.

A web log timestamp bug is fixed (by using timegm() instead of mktime().

web_api_v1 logsmanagement API is only available in debugging now.

Squashed commit of the following:

commit 32cf038
Author: Dim-P <[email protected]>
Date:   Tue Sep 19 16:21:32 2023 +0300

    Tidy up

commit f956b58
Author: Dim-P <[email protected]>
Date:   Tue Sep 19 13:30:54 2023 +0300

    Add more accepted params. Add data_only option. Add if_modified_since option.

commit 588c242
Author: Dim-P <[email protected]>
Date:   Mon Sep 18 18:39:50 2023 +0300

    Add timeout to queries

commit da0f055
Author: Dim-P <[email protected]>
Date:   Thu Sep 14 19:17:16 2023 +0300

    Fix histogram

commit 7149890
Author: Dim-P <[email protected]>
Date:   Thu Sep 14 17:58:52 2023 +0300

    Add keyword query using simple patterns and fix descending timestamp values

commit 0bd068c
Author: Dim-P <[email protected]>
Date:   Thu Sep 14 13:54:05 2023 +0300

    Add basename, filename, chartname as facets

commit 023c2b5
Author: Dim-P <[email protected]>
Date:   Thu Sep 14 13:26:06 2023 +0300

    Add info and sources functions options

commit ab4d555
Author: Dim-P <[email protected]>
Date:   Thu Sep 14 12:54:37 2023 +0300

    Fix facet id filter

commit a69c9e2
Author: Dim-P <[email protected]>
Date:   Thu Sep 14 12:07:13 2023 +0300

    WIP: Add facet id filters

commit 3c02b5d
Author: Dim-P <[email protected]>
Date:   Tue Sep 12 18:19:17 2023 +0300

    Add log source and log type to circ buff query results header

commit 8ca9867
Author: Dim-P <[email protected]>
Date:   Tue Sep 12 18:18:13 2023 +0300

    Fix logsmanagement facet function after master rebasing

commit 3f1517a
Author: Dim-P <[email protected]>
Date:   Tue Sep 12 18:14:25 2023 +0300

    Restrict /logsmanagement to ACL_DEV_OPEN_ACCESS only

commit 8ca98d6
Author: Dim-P <[email protected]>
Date:   Tue Sep 12 14:40:22 2023 +0300

    Fix incorrectly parsed timestamps due to DST

commit f9b0848
Author: Dim-P <[email protected]>
Date:   Mon Sep 11 13:42:18 2023 +0300

    Add logs_management_meta object to facet query results

commit babc978
Author: Dim-P <[email protected]>
Date:   Mon Sep 11 13:03:52 2023 +0300

    Query all sources if no arguments provided

commit 486d56d
Author: Dim-P <[email protected]>
Date:   Thu Sep 7 18:38:04 2023 +0300

    Add log_source and log_type (only for DB logs) as facets. Add relative time support

commit b564c12
Author: Dim-P <[email protected]>
Date:   Thu Sep 7 13:47:20 2023 +0300

    Working facet with descending timestamps

commit 68c6a5c
Author: Dim-P <[email protected]>
Date:   Wed Sep 6 01:55:51 2023 +0300

    WIP

* Fix linking errors

* Convert logs management to external plugin.

Squashed commit of the following:

commit 16da6ba
Author: Dim-P <[email protected]>
Date:   Tue Oct 24 18:44:12 2023 +0100

    Use higher value of update every from netdata.conf or logsmanagement.d.conf

commit 88cc349
Author: Dim-P <[email protected]>
Date:   Tue Oct 24 18:43:02 2023 +0100

    Tidy up

commit c3fca57
Author: Dim-P <[email protected]>
Date:   Tue Oct 24 18:02:04 2023 +0100

    Use external update_every from agent, if available

commit f747070
Author: Dim-P <[email protected]>
Date:   Tue Oct 24 17:40:46 2023 +0100

    Re-enable debug logs

commit b34f5ac
Author: Dim-P <[email protected]>
Date:   Tue Oct 24 15:49:20 2023 +0100

    Remove old API calls from web_api_v1.c/h

commit 7fbc1e6
Author: Dim-P <[email protected]>
Date:   Tue Oct 24 15:32:04 2023 +0100

    Add proper termination of stats charts thread

commit 4c0fc05
Author: Dim-P <[email protected]>
Date:   Tue Oct 24 15:31:36 2023 +0100

    Add tests for logsmanag_config functions

commit 4dfdacb
Author: Dim-P <[email protected]>
Date:   Mon Oct 23 22:01:19 2023 +0100

    Remove unused headers from logsmanagement.c

commit b324ef3
Author: Dim-P <[email protected]>
Date:   Mon Oct 23 21:56:26 2023 +0100

    Remove inline from get_X_dir() functions

commit e9656e8
Author: Dim-P <[email protected]>
Date:   Mon Oct 23 21:50:32 2023 +0100

    Proper termination when a signal is received

commit b09eec1
Author: Dim-P <[email protected]>
Date:   Mon Oct 23 20:12:13 2023 +0100

    Refactor logs management config code in separate source files

commit 014b46a
Author: Dim-P <[email protected]>
Date:   Mon Oct 23 14:54:47 2023 +0100

    Fix p_file_info_destroy() crash

commit e0bdfd1
Author: Dim-P <[email protected]>
Date:   Mon Oct 23 14:18:27 2023 +0100

    Code refactoring and cleanup

commit 6a61cb6
Author: Dim-P <[email protected]>
Date:   Fri Oct 20 14:08:43 2023 +0100

    Fix 'source:all' queries

commit 45b516a
Author: Dim-P <[email protected]>
Date:   Thu Oct 19 21:51:05 2023 +0100

    Working 'source:...' queries and regular data queries (but not 'source:all')

commit 8064b0e
Author: Dim-P <[email protected]>
Date:   Thu Oct 19 15:34:23 2023 +0100

    Fix issue due to p_file_info_destroy()

commit a0aacc9
Author: Dim-P <[email protected]>
Date:   Tue Oct 17 22:06:34 2023 +0100

    Work on facet API changes

commit 480584f
Author: Dim-P <[email protected]>
Date:   Mon Oct 16 21:43:06 2023 +0100

    Add stats charts, running as separate thread

commit 34d582d
Author: Dim-P <[email protected]>
Date:   Mon Oct 16 16:24:02 2023 +0100

    Add SSL cipher charts

commit ced27ee
Author: Dim-P <[email protected]>
Date:   Sun Oct 15 21:33:29 2023 +0100

    Add Response code family, Response code, Response code type, SSL protocol charts

commit 40c4a1d
Author: Dim-P <[email protected]>
Date:   Sat Oct 14 00:48:48 2023 +0100

    Add more web log charts

commit 890ed3f
Author: Dim-P <[email protected]>
Date:   Fri Oct 13 22:14:11 2023 +0100

    Add web log vhosts and ports charts

commit 84733b6
Author: Dim-P <[email protected]>
Date:   Thu Oct 12 21:40:16 2023 +0100

    Add systemd charts

commit 1467350
Author: Dim-P <[email protected]>
Date:   Wed Oct 11 00:28:43 2023 +0100

    Add MQTT charts

commit 366eb63
Author: Dim-P <[email protected]>
Date:   Tue Oct 10 21:46:19 2023 +0100

    Complete kmsg changes. Reduce mem usage. Fix a dictionary key size bug

commit 3d02163
Author: Dim-P <[email protected]>
Date:   Tue Oct 10 19:18:41 2023 +0100

    Add kmsg Subsystem charts

commit e61af4b
Author: Dim-P <[email protected]>
Date:   Tue Oct 10 16:21:29 2023 +0100

    Fix bug of wrong kmsg timestamps in case of use_log_timestamp == 0

commit 03d22e0
Author: Dim-P <[email protected]>
Date:   Tue Oct 10 16:20:47 2023 +0100

    Add kmsg charts, except for Subsystem and Device

commit f60b078
Author: Dim-P <[email protected]>
Date:   Tue Oct 10 13:12:13 2023 +0100

    Initialise all docker events chart dimensions at startup

commit 5d873d3
Author: Dim-P <[email protected]>
Date:   Tue Oct 10 00:53:35 2023 +0100

    WIP: Add Docker events logs

commit 2cc3d6d
Author: Dim-P <[email protected]>
Date:   Mon Oct 9 18:52:27 2023 +0100

    Use macros for num_of_logs_charts and custom_charts functions

commit fbd48ad
Author: Dim-P <[email protected]>
Date:   Mon Oct 9 18:26:17 2023 +0100

    Refactor custom charts code for clarity and speed

commit a31d80b
Author: Dim-P <[email protected]>
Date:   Thu Oct 5 23:58:27 2023 +0100

    Add first working iteration of custom charts

commit b1e4ab8
Author: Dim-P <[email protected]>
Date:   Thu Oct 5 23:57:27 2023 +0100

    Add more custom charts for Netdata error.log

commit f1b7605
Author: Dim-P <[email protected]>
Date:   Thu Oct 5 20:39:40 2023 +0100

    Convert collected_logs_* chart updates to macros

commit 1459bc2
Author: Dim-P <[email protected]>
Date:   Thu Oct 5 19:11:54 2023 +0100

    Use rrdset_timed_done() instead of duration_since_last_update for correct chart timings

commit 876854c
Author: Dim-P <[email protected]>
Date:   Tue Oct 3 21:53:14 2023 +0100

    Fix some bugs in chart updates

commit ae87508
Author: Dim-P <[email protected]>
Date:   Tue Oct 3 21:32:55 2023 +0100

    Functioning generic_chart_init() and generic_chart_update()

commit 982a9c4
Author: Dim-P <[email protected]>
Date:   Thu Sep 28 23:32:52 2023 +0100

    Add support for multiple .conf files. Add stock examples.

commit 8e8abd0
Author: Dim-P <[email protected]>
Date:   Thu Sep 28 17:38:30 2023 +0100

    Add support for logsmanagement.d/default.conf

commit 1bf0732
Author: Dim-P <[email protected]>
Date:   Thu Sep 28 14:31:03 2023 +0100

    Add capabilities. Fix paths in logsmanagement.d.conf

commit a849d5b
Author: Dim-P <[email protected]>
Date:   Tue Sep 26 23:06:31 2023 +0100

    Change logs_manag_config_load()

commit b0d1783
Author: Dim-P <[email protected]>
Date:   Tue Sep 26 15:35:30 2023 +0100

    Working unit tests and argument parsing

commit 6da1b42
Author: Dim-P <[email protected]>
Date:   Fri Sep 22 00:32:47 2023 +0300

    Build logs-management.plugin successfully

commit 9e30efe
Author: Dim-P <[email protected]>
Date:   Thu Sep 21 16:13:21 2023 +0300

    Fix print format specifier in web_client_api_request_v1_logsmanagement()

* Modify CODEOWNERS

* Update README.md

Fix indentation

* Change snprintfz() to stncpyz() in circ_buff_search(). Change remaining 'chart_name' to 'chartname'.

* Replace SQLite version function with macro

* Fix some codacy warnings

* Update README.md

* Update Fluent Bit to v2.1.10

* Remove some comments

* Fix Fluent Bit shared library linking for armv7l and FreeBSD

* Remove compression source files

* Add prefix to rrd_api.h functions

* Add more unit tests

* Fix kmsg capabilities

* Separate kmsg and systemd default paths

* Fix some memory leaks and better termination of DB

* Add iterative queries if quota is exceeded

* Fix centos7 builds

* Fix issue where SYSTEMD timestamps are not parsed

* Fix logs management packaging.

* Fix typo in DEB control file.

* Fix indentation and missing new line at EOF

* Clean up functions and update help

* Fix 400 error when no queryable sources are available

* Fix if_modified_since. Add FACET_MAX_VALUE_LENGTH

* Add delta parameter and use anchor points in queries

* Fix CodeQL netdata#182 warning

* Fix packaging issues.

* Fix postinstall script for DEB packages.

* Improve plugin shutdown speed

* Fix docker events chart grouping

* Fix functions evloop threads not terminating upon shutdown

* Fix coverity issues

* Fix logging

* Replace 'Netdata error.log' with 'Netdata daemon.log' in 'default.conf'

* Remove 'enabled = yes/no' config in logsmanagement.d.conf

* Remove 'enabled = X' unused config from logsmanagement.d.conf

---------

Co-authored-by: Austin S. Hemmelgarn <[email protected]>
  • Loading branch information
Dim-P and Ferroin authored Nov 27, 2023
1 parent 1f0164e commit 4e51241
Show file tree
Hide file tree
Showing 99 changed files with 14,778 additions and 58 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ system/ @Ferroin @tkatsoulas
tests/ @Ferroin @vkalintiris @tkatsoulas
web/ @thiagoftsm @vkalintiris
web/gui/ @novykh
logsmanagement/ @Dim-P @thiagoftsm

# Ownership by filetype (overwrites ownership by directory)
*.am @Ferroin @tkatsoulas
Expand Down
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,6 @@ area/tests:

area/web:
- web/**

area/logs-management:
- logsmanagement/**
1 change: 1 addition & 0 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ jobs:
./.git/*
packaging/makeself/makeself.sh
packaging/makeself/makeself-header.sh
./fluent-bit/*
yamllint:
name: yamllint
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ debugfs.plugin
systemd-journal.plugin
!systemd-journal.plugin/

logs-management.plugin
!logs-management.plugin/

# protoc generated files
*.pb.cc
*.pb.h
Expand Down Expand Up @@ -153,6 +156,8 @@ collectors/ioping.plugin/ioping.plugin
collectors/go.d.plugin
web/netdata-switch-dashboard.sh

logsmanagement/stress_test/stress_test

# installer generated files
/netdata-uninstaller.sh
/netdata-updater.sh
Expand Down
5 changes: 5 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@
path = web/server/h2o/libh2o
url = https://github.com/h2o/h2o.git
ignore = untracked
[submodule "fluent-bit"]
path = fluent-bit
url = https://github.com/fluent/fluent-bit.git
shallow = true
ignore = dirty
46 changes: 45 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,44 @@ ELSE()
message(STATUS "ML: disabled")
ENDIF()

set(LOGSMANAGEMENT_FILES
logsmanagement/rrd_api/rrd_api_docker_ev.c
logsmanagement/rrd_api/rrd_api_docker_ev.h
logsmanagement/rrd_api/rrd_api_generic.c
logsmanagement/rrd_api/rrd_api_generic.h
logsmanagement/rrd_api/rrd_api_kernel.c
logsmanagement/rrd_api/rrd_api_kernel.h
logsmanagement/rrd_api/rrd_api_mqtt.c
logsmanagement/rrd_api/rrd_api_mqtt.h
logsmanagement/rrd_api/rrd_api_stats.c
logsmanagement/rrd_api/rrd_api_stats.h
logsmanagement/rrd_api/rrd_api_systemd.c
logsmanagement/rrd_api/rrd_api_systemd.h
logsmanagement/rrd_api/rrd_api_web_log.c
logsmanagement/rrd_api/rrd_api_web_log.h
logsmanagement/rrd_api/rrd_api.h
logsmanagement/unit_test/unit_test.c
logsmanagement/unit_test/unit_test.h
logsmanagement/circular_buffer.c
logsmanagement/circular_buffer.h
logsmanagement/db_api.c
logsmanagement/db_api.h
logsmanagement/file_info.h
logsmanagement/flb_plugin.c
logsmanagement/flb_plugin.h
logsmanagement/functions.c
logsmanagement/functions.h
logsmanagement/helper.h
logsmanagement/defaults.h
logsmanagement/logsmanag_config.c
logsmanagement/logsmanag_config.h
logsmanagement/logsmanagement.c
logsmanagement/parser.c
logsmanagement/parser.h
logsmanagement/query.c
logsmanagement/query.h
)

set(NETDATA_FILES
collectors/all.h
${DAEMON_FILES}
Expand Down Expand Up @@ -1112,6 +1150,13 @@ add_definitions(
-DVARLIB_DIR="/var/lib/netdata"
)

# -----------------------------------------------------------------------------
# logs management

IF(ENABLE_LOGSMANAGEMENT)
list(APPEND NETDATA_FILES ${LOGSMANAGEMENT_FILES})
ENDIF()

# -----------------------------------------------------------------------------
# kinesis exporting connector

Expand Down Expand Up @@ -1748,7 +1793,6 @@ endif()
endif()
endif()


# generate config.h so that CMake becomes independent of automake

## netdata version
Expand Down
57 changes: 57 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ SUBDIRS += \
web \
claim \
spawn \
logsmanagement \
$(NULL)

AM_CFLAGS = \
Expand Down Expand Up @@ -349,6 +350,51 @@ LOG2JOURNAL_FILES = \
libnetdata/log/log2journal.c \
$(NULL)


LOGSMANAGEMENT_FILES = \
logsmanagement/circular_buffer.c \
logsmanagement/circular_buffer.h \
logsmanagement/db_api.c \
logsmanagement/db_api.h \
logsmanagement/defaults.h \
logsmanagement/file_info.h \
logsmanagement/flb_plugin.c \
logsmanagement/flb_plugin.h \
logsmanagement/functions.c \
logsmanagement/functions.h \
logsmanagement/helper.h \
logsmanagement/logsmanag_config.c \
logsmanagement/logsmanag_config.h \
logsmanagement/logsmanagement.c \
logsmanagement/parser.c \
logsmanagement/parser.h \
logsmanagement/query.c \
logsmanagement/query.h \
logsmanagement/rrd_api/rrd_api_docker_ev.c \
logsmanagement/rrd_api/rrd_api_docker_ev.h \
logsmanagement/rrd_api/rrd_api_generic.c \
logsmanagement/rrd_api/rrd_api_generic.h \
logsmanagement/rrd_api/rrd_api_kernel.c \
logsmanagement/rrd_api/rrd_api_kernel.h \
logsmanagement/rrd_api/rrd_api_mqtt.c \
logsmanagement/rrd_api/rrd_api_mqtt.h \
logsmanagement/rrd_api/rrd_api_stats.c \
logsmanagement/rrd_api/rrd_api_stats.h \
logsmanagement/rrd_api/rrd_api_systemd.c \
logsmanagement/rrd_api/rrd_api_systemd.h \
logsmanagement/rrd_api/rrd_api_web_log.c \
logsmanagement/rrd_api/rrd_api_web_log.h \
logsmanagement/rrd_api/rrd_api.h \
database/sqlite/sqlite3.c \
database/sqlite/sqlite3.h \
$(LIBNETDATA_FILES) \
$(NULL)

LOGSMANAGEMENT_TESTS_FILES = \
logsmanagement/unit_test/unit_test.c \
logsmanagement/unit_test/unit_test.h \
$(NULL)

CUPS_PLUGIN_FILES = \
collectors/cups.plugin/cups_plugin.c \
$(LIBNETDATA_FILES) \
Expand Down Expand Up @@ -1342,6 +1388,17 @@ systemd_cat_native_LDADD = \
$(NETDATA_COMMON_LIBS) \
$(NULL)

if ENABLE_LOGSMANAGEMENT
plugins_PROGRAMS += logs-management.plugin
logs_management_plugin_SOURCES = $(LOGSMANAGEMENT_FILES)
if ENABLE_LOGSMANAGEMENT_TESTS
logs_management_plugin_SOURCES += $(LOGSMANAGEMENT_TESTS_FILES)
endif
logs_management_plugin_LDADD = \
$(NETDATA_COMMON_LIBS) \
$(NULL)
endif

if ENABLE_PLUGIN_EBPF
plugins_PROGRAMS += ebpf.plugin
ebpf_plugin_SOURCES = $(EBPF_PLUGIN_FILES)
Expand Down
7 changes: 4 additions & 3 deletions build_external/clean-install-arch-debug.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ RUN find . -type f >/opt/netdata/manifest
RUN CFLAGS="-Og -g -ggdb -Wall -Wextra -Wformat-signedness -DNETDATA_INTERNAL_CHECKS=1\
-DNETDATA_VERIFY_LOCKS=1 ${EXTRA_CFLAGS}" ./netdata-installer.sh --require-cloud --disable-lto

RUN ln -sf /dev/stdout /var/log/netdata/access.log
RUN ln -sf /dev/stdout /var/log/netdata/debug.log
RUN ln -sf /dev/stderr /var/log/netdata/error.log
RUN ln -sf /dev/stdout /var/log/netdata/access.log && \
ln -sf /dev/stdout /var/log/netdata/debug.log && \
ln -sf /dev/stderr /var/log/netdata/error.log && \
ln -sf /dev/stdout /var/log/netdata/fluentbit.log

RUN printf >/opt/netdata/source/gdb_batch '\
set args -D \n\
Expand Down
7 changes: 4 additions & 3 deletions build_external/clean-install-arch-extras.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ RUN find . -type f >/opt/netdata/manifest
RUN CFLAGS="-Og -g -ggdb -Wall -Wextra -Wformat-signedness -DNETDATA_INTERNAL_CHECKS=1\
-DNETDATA_VERIFY_LOCKS=1 ${EXTRA_CFLAGS}" ./netdata-installer.sh --require-cloud --disable-lto

RUN ln -sf /dev/stdout /var/log/netdata/access.log
RUN ln -sf /dev/stdout /var/log/netdata/debug.log
RUN ln -sf /dev/stderr /var/log/netdata/error.log
RUN ln -sf /dev/stdout /var/log/netdata/access.log && \
ln -sf /dev/stdout /var/log/netdata/debug.log && \
ln -sf /dev/stderr /var/log/netdata/error.log && \
ln -sf /dev/stdout /var/log/netdata/fluentbit.log

RUN rm /var/lib/netdata/registry/netdata.public.unique.id

Expand Down
7 changes: 4 additions & 3 deletions build_external/clean-install-arch.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ RUN find . -type f >/opt/netdata/manifest
RUN CFLAGS="-O1 -ggdb -Wall -Wextra -Wformat-signedness -DNETDATA_INTERNAL_CHECKS=1\
-DNETDATA_VERIFY_LOCKS=1 ${EXTRA_CFLAGS}" ./netdata-installer.sh --disable-lto

RUN ln -sf /dev/stdout /var/log/netdata/access.log
RUN ln -sf /dev/stdout /var/log/netdata/debug.log
RUN ln -sf /dev/stderr /var/log/netdata/error.log
RUN ln -sf /dev/stdout /var/log/netdata/access.log && \
ln -sf /dev/stdout /var/log/netdata/debug.log && \
ln -sf /dev/stderr /var/log/netdata/error.log && \
ln -sf /dev/stdout /var/log/netdata/fluentbit.log

CMD ["/usr/sbin/netdata", "-D"]
7 changes: 4 additions & 3 deletions build_external/clean-install.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ RUN find . -type f >/opt/netdata/manifest
RUN CFLAGS="-O1 -ggdb -Wall -Wextra -Wformat-signedness -DNETDATA_INTERNAL_CHECKS=1\
-DNETDATA_VERIFY_LOCKS=1 ${EXTRA_CFLAGS}" ./netdata-installer.sh --disable-lto

RUN ln -sf /dev/stdout /var/log/netdata/access.log
RUN ln -sf /dev/stdout /var/log/netdata/debug.log
RUN ln -sf /dev/stderr /var/log/netdata/error.log
RUN ln -sf /dev/stdout /var/log/netdata/access.log && \
ln -sf /dev/stdout /var/log/netdata/debug.log && \
ln -sf /dev/stderr /var/log/netdata/error.log && \
ln -sf /dev/stdout /var/log/netdata/fluentbit.log

RUN rm /var/lib/netdata/registry/netdata.public.unique.id

Expand Down
5 changes: 5 additions & 0 deletions collectors/all.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,11 @@

#define NETDATA_CHART_PRIO_STATSD_PRIVATE 90000 // many charts

// Logs Management

#define NETDATA_CHART_PRIO_LOGS_BASE 95000 // many charts
#define NETDATA_CHART_PRIO_LOGS_STATS_BASE 160000 // logsmanagement stats in "Netdata Monitoring"

// PCI

#define NETDATA_CHART_PRIO_PCI_AER 100000
Expand Down
1 change: 1 addition & 0 deletions collectors/apps.plugin/apps_groups.conf
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ go.d.plugin: *go.d.plugin*
slabinfo.plugin: *slabinfo.plugin*
ebpf.plugin: *ebpf.plugin*
debugfs.plugin: *debugfs.plugin*
logs-management.plugin: *logs-management.plugin*

# agent-service-discovery
agent_sd: agent_sd
Expand Down
7 changes: 7 additions & 0 deletions collectors/plugins.d/plugins_d.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,13 @@ void *pluginsd_main(void *ptr)

// disable some plugins by default
config_get_boolean(CONFIG_SECTION_PLUGINS, "slabinfo", CONFIG_BOOLEAN_NO);
config_get_boolean(CONFIG_SECTION_PLUGINS, "logs-management",
#if defined(LOGS_MANAGEMENT_STRESS_TEST)
CONFIG_BOOLEAN_YES
#else
CONFIG_BOOLEAN_NO
#endif
);
// it crashes (both threads) on Alpine after we made it multi-threaded
// works with "--device /dev/ipmi0", but this is not default
// see https://github.com/netdata/netdata/pull/15564 for details
Expand Down
17 changes: 12 additions & 5 deletions collectors/plugins.d/pluginsd_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,9 @@ static inline PARSER_RC pluginsd_begin(char **words, size_t num_words, PARSER *p
}

static inline PARSER_RC pluginsd_end(char **words, size_t num_words, PARSER *parser) {
UNUSED(words);
UNUSED(num_words);
char *tv_sec = get_word(words, num_words, 1);
char *tv_usec = get_word(words, num_words, 2);
char *pending_rrdset_next = get_word(words, num_words, 3);

RRDHOST *host = pluginsd_require_scope_host(parser, PLUGINSD_KEYWORD_END);
if(!host) return PLUGINSD_DISABLE_PLUGIN(parser, NULL, NULL);
Expand All @@ -494,9 +495,15 @@ static inline PARSER_RC pluginsd_end(char **words, size_t num_words, PARSER *par
pluginsd_clear_scope_chart(parser, PLUGINSD_KEYWORD_END);
parser->user.data_collections_count++;

struct timeval now;
now_realtime_timeval(&now);
rrdset_timed_done(st, now, /* pending_rrdset_next = */ false);
struct timeval tv = {
.tv_sec = (tv_sec && *tv_sec) ? str2ll(tv_sec, NULL) : 0,
.tv_usec = (tv_usec && *tv_usec) ? str2ll(tv_usec, NULL) : 0
};

if(!tv.tv_sec)
now_realtime_timeval(&tv);

rrdset_timed_done(st, tv, pending_rrdset_next && *pending_rrdset_next ? true : false);

return PARSER_RC_OK;
}
Expand Down
Loading

0 comments on commit 4e51241

Please sign in to comment.