Skip to content
Open
Changes from 1 commit
Commits
Show all changes
317 commits
Select commit Hold shift + click to select a range
785b7e3
downstream: fixed the event loop registration detection mechanism
Jun 15, 2023
c1641b3
Update src/flb_downstream.c
Jun 29, 2023
d14fd21
in_kubernetes_filter: fix leak on exception
edsiper Jun 5, 2023
5aa4196
workflows: enable sarif output for CIFuzz (#7630)
DavidKorczynski Jul 3, 2023
8861650
tests: internal: fuzzers: add cmetrics decoder fuzzer
DavidKorczynski Jun 26, 2023
26b5d74
tests: internal: fuzzers: move variable declaration
DavidKorczynski Jun 30, 2023
f0c266b
in_exec_wasi: fix possible NULL deref
DavidKorczynski Jun 30, 2023
ce856fd
in_exec_wasi: add error message
DavidKorczynski Jun 30, 2023
4e2dafd
upstream: fix logic to restrict number of connections
edsiper Jul 11, 2023
736d7cd
workflows: bump helm/kind-action from 1.7.0 to 1.8.0 (#7687)
dependabot[bot] Jul 12, 2023
d6562d5
out_chronicle: Implement Google Chronicle output plugin (#7232)
cosmo0920 Jul 12, 2023
80e09ab
out_stackdriver: support gzip compression (#7101)
CatherineF-dev Jul 12, 2023
0af7416
CODEOWNERS: Add codeowners for out_stackdriver (#7693)
braydonk Jul 12, 2023
0e45937
codeowners: add pwhelan for calyptia and calyptia fleet. (#7692)
pwhelan Jul 12, 2023
efe9973
release: update to 2.1.8 (#7698)
github-actions[bot] Jul 13, 2023
69e6bb6
aws: imds: set length when initializing token to dummy value
joshuabaird Jul 11, 2023
5a333a2
in_node_exporter_metrics: updated renamed function reference
Jun 14, 2023
7a8861e
CODEOWNERS: Google owners for out_stackdriver test (#7694)
braydonk Jul 17, 2023
ec56476
output: added metrics for upstream connections
Jul 17, 2023
464dfe2
upstream: added metrics for upstream connections
Jul 17, 2023
8182f25
upstream: added parent upstream transversal to the metrics functions
Jul 17, 2023
149ccd6
downstream: remove not used variable
nokute78 Jul 14, 2023
0104b0b
build: fix typo in CMakeLists.txt for Kubernetes Event (#7700)
pr0PM Jul 18, 2023
30b27ce
build: test: Fix an invalid constant for filter_rewrite_tag (#7675)
cosmo0920 Jul 18, 2023
f4926d4
build: Install OpenSSL with chocolatey only for x64 (#7719)
cosmo0920 Jul 19, 2023
8dad575
in_tail: don't append records if sl_log_event_encoder buffer is 0 (#7…
danlenar Jul 20, 2023
9c94898
calyptia_fleet: fix to use custom calyptia plugin on reload.
pwhelan Jul 18, 2023
0001568
calyptia_fleet: fix problems with valgrind.
pwhelan Jul 18, 2023
523de85
lib: monkey: upgrade to v1.7.0
edsiper Jul 18, 2023
7e6451d
in_splunk: fix unused arg
nokute78 Jul 14, 2023
de3da37
in_splunk: remove not used variables
nokute78 Jul 14, 2023
2b55d11
in_tail: fix ignore_older description.
lecaros Jul 13, 2023
7cc4be9
in_kafka: Fix json packing
tchrono May 29, 2023
74895a5
in_kafka: Implement "data_format" config option.
tchrono May 29, 2023
9b348d1
examples: Update kafka_filter example conf
tchrono May 29, 2023
9bae8f0
in_kafka: Use config map to fetch data_format option
tchrono Jun 20, 2023
d810d5f
in_kafka: rename data_format to format
tchrono Jul 17, 2023
14f995f
in_http: add support for form/url_encoded payloads. (#6960)
pwhelan Jul 20, 2023
6b78604
out_statsd: add missing FLB_INPUT_NET_SERVER flag.
pwhelan Jul 19, 2023
013b1ad
in_collectd: add missing FLB_INPUT_NET_SERVER flag.
pwhelan Jul 19, 2023
9e5d567
lib: monkey: upgrade to v1.7.1 (fix warnings)
edsiper Jul 21, 2023
295d9ee
trace: add new command line options for enabling tracing at startup. …
pwhelan Jul 21, 2023
1d61d70
sp: remove unused variable
edsiper Jul 20, 2023
3d9d872
callback: fix function prototype
edsiper Jul 20, 2023
c28d168
network: initialize result var for unix socket
edsiper Jul 20, 2023
e0a6324
utils: fix function prototype
edsiper Jul 20, 2023
b48a9cb
time: fix size_t formatter
edsiper Jul 20, 2023
a840027
tp: fix function prototype
edsiper Jul 20, 2023
3fa9d18
snappy: initialize variable
edsiper Jul 20, 2023
1b6668e
input: remove unused variable
edsiper Jul 21, 2023
a55ad35
help: initialize variable
edsiper Jul 21, 2023
0dd6d40
reload: fix format and remove unused variable
edsiper Jul 21, 2023
0e3ac82
storage: remove unused variable
edsiper Jul 21, 2023
08d060c
strptime: add variable cast to gmtime_r call
edsiper Jul 21, 2023
5acb549
luajit: fix function prototype
edsiper Jul 21, 2023
f832b7c
filter_kubernetes: remove unused variabe
edsiper Jul 21, 2023
c86fab9
filter_multiline: remove unused variable
edsiper Jul 21, 2023
04b82cb
filter_modify: remove unused variab;e
edsiper Jul 21, 2023
d7648e5
filter_nightfall: initialize variable
edsiper Jul 21, 2023
738835f
in_forward: remove unused variable
edsiper Jul 21, 2023
3fb29b4
out_azure_logs_ingestion: initialize variable
edsiper Jul 21, 2023
ce495a0
out_prometheus_remote_write: add cast to variable
edsiper Jul 21, 2023
9760562
out_splunk: remove unused variable
edsiper Jul 21, 2023
12ef127
in_mqtt: remove unused variable
edsiper Jul 21, 2023
2a1f2b9
in_event_type: fix cfl function prototype
edsiper Jul 21, 2023
dd02955
in_splunk: initialize variable
edsiper Jul 21, 2023
70b442c
in_elasticsearch: remove unused variable
edsiper Jul 21, 2023
accfe9c
in_head: remove unused variables
edsiper Jul 21, 2023
707e7c7
chunk_traces: update the help for '--enable-chunk-trace'.
pwhelan Jul 21, 2023
585e89a
connection: a shutdown guard flag was added
Jul 20, 2023
6e8092a
upstream: decoupled socket shutdown from upstream connection release
Jul 20, 2023
782d9ab
in_calyptia_fleet: add fleet_name parameter.
pwhelan Jul 7, 2023
a0e8713
custom_calyptia: set calyptia_name after instancing the input plugin.
pwhelan Jul 7, 2023
e801acb
in_calyptia_fleet: check for search errors.
pwhelan Jul 7, 2023
f187b04
custom_calyptia: do not register as agent before loading configuration.
pwhelan Jul 20, 2023
16605b7
in_calyptia_fleet: fix use after free and non-null terminated string.
pwhelan Jul 20, 2023
fcd1364
in_calyptia_fleet: maintain fleet_name parameter across reloads.
pwhelan Jul 20, 2023
b6576c7
in_calyptia_fleet: keep casing consistent in the generated configurat…
pwhelan Jul 20, 2023
a6bff43
core: introduced batch flush result processing
Jul 21, 2023
b91df9b
core: changed the flush event priority
Jul 21, 2023
07b8ea1
output: added a flush abortion mechanism
Jul 21, 2023
78f8a1f
task: added locking and route dropping mechanisms
Jul 21, 2023
2d0ac1b
storage_backlog: changed the release strategy
Jul 21, 2023
b69f6a6
input_chunk: changed the chunk release strategy
Jul 21, 2023
5560628
config: allow up to 32MB length of line buffer in read_config (#7691)
tchrono Jul 24, 2023
82c3ef1
in_syslog: Provide appending source address parameter (#7651)
cosmo0920 Jul 24, 2023
04cf2f2
bin: remove cleanup code from flb_signal_exit (#7735)
nokute78 Jul 25, 2023
d8916aa
release: update to 2.1.9 (#7753)
github-actions[bot] Jul 26, 2023
4b5f38e
workflows: disable provenance for legacy format images (#7766)
Jul 28, 2023
16dbffe
workflows: add extra push of arch-specfic images (#7767)
Jul 28, 2023
6df51da
workflows: windows: Use vcpkg to install dependencies (#7764)
cosmo0920 Jul 28, 2023
ac136a9
workflows: windows: Implement cache mechanism for source packages of …
cosmo0920 Aug 1, 2023
c247be6
workflow: windows: Make more rigid handling for caches (#7780)
cosmo0920 Aug 2, 2023
3b8f079
out_stackdriver: change default workers to 1
chicocvenancio Aug 1, 2023
bf6b127
ci: remove azure resources and tests (#7787)
celalettin1286 Aug 3, 2023
0674883
ci: add codeowner celalettin1286 (#7794)
celalettin1286 Aug 4, 2023
6a9f9cc
in_prometheus_scrape: added authorization support (#7785)
Aug 4, 2023
7c981b5
config_format: fix possible heap overflow (#7768)
DavidKorczynski Aug 8, 2023
01cdadd
tests: fuzzers: utils_fuzzer: extend
DavidKorczynski Jul 24, 2023
6f54e3d
tests: internal: fuzzers: cmetrics_fuzzer: extend
DavidKorczynski Jul 24, 2023
197ff40
tests: internal: fuzzers: add input fuzzer
DavidKorczynski Jul 24, 2023
cc81df2
utils: check existence of machine-id files before reading them. (#7806)
pwhelan Aug 10, 2023
757e032
aws: Allocate S3_KEY_SIZE +1 instead of S3_KEY_SIZE for allocating bu…
cosmo0920 Jul 31, 2023
a88708c
out_kinesis_firefose: fix typo
nokute78 Aug 5, 2023
8f4300f
out_kinesis_streams: fix typo
nokute78 Aug 5, 2023
59ed0dc
input: send resume signal to the input thread event loop if plugin is…
danlenar Aug 9, 2023
b2900a4
config: throw an error if a configuration property is not applied.
pwhelan Aug 2, 2023
5a24487
config: update comment about setting ret to -1.
pwhelan Aug 9, 2023
8dc84d2
in_windows_exporter_metrics: Implement WMI based memory and paging_fi…
cosmo0920 Aug 19, 2023
c2eb12b
lib: c-ares: upgrade to v1.19.1
edsiper Aug 21, 2023
b7954b8
core: Expand pthread stack size on macOS
cosmo0920 Jul 31, 2023
bc04aab
in_event_test: Add +1 for acceptable time elapse
cosmo0920 Aug 11, 2023
31f999a
yaml/v2: use stack based parser. (#7661)
pwhelan Aug 22, 2023
4c37d91
tests: internal: fuzzers: add config yaml fuzzer
DavidKorczynski Aug 9, 2023
29593b0
tests: internal: fuzzers: add mp fuzzer
DavidKorczynski Aug 11, 2023
8ce5037
emitter_create: exit and destroy instance on fail
BrewedCoffee Aug 8, 2023
88471cc
out_kinesis_streams: remove dead stores
DavidKorczynski Aug 8, 2023
30e2aea
tests: runtime: in_mqtt: add test for in_mqtt
nokute78 Aug 26, 2023
18914ee
tests: runtime: in_mqtt: add test for payload_key
nokute78 Aug 27, 2023
7fa08e6
in_mqtt: support payload_key
nokute78 Aug 27, 2023
b273cb6
in_winevtlog: Support XML query parameter for filtering events
cosmo0920 Aug 22, 2023
45fcc61
custom_calyptia: submit metrics when not in fleet mode.
pwhelan Aug 16, 2023
019fdbf
custom_calyptia: clarify code that conditionally activates metrics.
pwhelan Aug 16, 2023
826843c
custom_calyptia: add missing new lines for if and else.
pwhelan Aug 21, 2023
eaa64da
in_calyptia_fleet: add missing new lines for if and else.
pwhelan Aug 21, 2023
2a14bee
custom_calyptia: update code to be more inline with coding guidelines.
pwhelan Aug 21, 2023
32c8bd1
in_calyptia_fleet: use more understandable variable names.
pwhelan Aug 21, 2023
fb7e0c5
tests: internal: lua: add test for flb_lua_arraylength
nokute78 Aug 12, 2023
c03ec43
lua: add flb_lua_dump_stack
nokute78 Aug 13, 2023
f70fc97
lua: pass index to lua_arraylength
nokute78 Aug 13, 2023
07d1932
tests: internal: lua: pass index to lua_arraylength
nokute78 Aug 13, 2023
c878c7d
in_exec_wasi: fix possible file descriptor leak
DavidKorczynski Aug 8, 2023
7302149
out_s3: fix potential file descriptor leak
DavidKorczynski Aug 8, 2023
c48590a
out_s3: fix file descriptor leak
DavidKorczynski Aug 8, 2023
6148f40
config_format: yaml: suppress debug messages.
pwhelan Aug 23, 2023
c62d4c8
config_format: yaml: add support for idiomatic Yaml camelCase (fix #7…
edsiper Aug 30, 2023
ea49619
tests: internal: config_format: yaml: add tests for idiomatic Yaml
edsiper Aug 30, 2023
9b01b9c
tests: internal: config_format: yaml: add tests for snake_case format
edsiper Aug 30, 2023
6c76c02
config_format: initialize as classic mode
edsiper Aug 30, 2023
b172646
config_format: allocate double space for camel conversion
edsiper Aug 30, 2023
0c0e658
tests: internal: config_format: yaml: destroy context after test
edsiper Aug 30, 2023
1d62291
tests: internal: config_format: fluentbit: destroy context after test
edsiper Aug 30, 2023
91c1a9e
config_format: check if Yaml support exists before using FLB_CF_YAML
edsiper Aug 30, 2023
6b9d50e
out_splunk: release flb_ra_translate result buffer on failure
Aug 31, 2023
9c74f21
config_format: yaml: fix null dereference
DavidKorczynski Aug 28, 2023
c9f38e1
in_node_exporter_metrics: Fix registering callback for systemd
cosmo0920 Aug 28, 2023
996d569
in_windows_exporter_metrics: Implement WMI based process metrics (#7860)
cosmo0920 Aug 31, 2023
9763d0b
in_udp: Add a capability to inject source IP (#7673)
cosmo0920 Aug 31, 2023
d1134e3
in_tail: removed ignore_older enforcement on files that are being ing…
Aug 9, 2023
58ac7b7
in_tail: refactored the progress check to signal the event based coll…
Aug 9, 2023
22bf267
in_lib: fix error handling after flb_log_event_decoder_next
nokute78 Jul 8, 2023
fdcf299
tls: openssl: added code to propagate syscall errors
Aug 3, 2023
2ccb996
upstream: added code to discard failed connections
Aug 3, 2023
59ce85a
io: added code to detect non-recoverable connection errors
Aug 3, 2023
ee834c5
io: added code to detect non-recoverable connection errors
Aug 3, 2023
2774e6c
io: changed some codes in net_io_propagate_critical_error
Aug 9, 2023
748aac0
in_nginx_exporter_metrics: add missing release function
nokute78 Aug 27, 2023
065be87
custom_calyptia: generate the default machine_id in custom_calyptia.
pwhelan Sep 4, 2023
fd8ba53
in_calyptia_fleet: use the machine_id in the fleet configuration dire…
pwhelan Sep 4, 2023
6517087
utils: suppress errno when file is empty but readable.
pwhelan Aug 17, 2023
569f897
utils: use ferror and not math to check file handler for error.
pwhelan Aug 29, 2023
0b12235
custom_calyptia: pass the fleet_id parameter and label to out_calyptia.
pwhelan Sep 4, 2023
5ac90a4
input: apply back pressure if input threaded plugin is paused (#7847)
danlenar Sep 4, 2023
dd64971
tests: internal: stream_processor: fix when test path is too long.
pwhelan Aug 24, 2023
20393d5
tests: internal: stream_processor: use more succint check for TEST_CH…
pwhelan Aug 28, 2023
605b74b
workflows: bump actions/checkout from 3 to 4 (#7894)
dependabot[bot] Sep 5, 2023
e6c95d9
release: update to 2.1.10 (#7895)
github-actions[bot] Sep 5, 2023
15b99e2
workflows: bump crazy-max/ghaction-chocolatey from 2 to 3 (#7909)
dependabot[bot] Sep 11, 2023
13afb9e
workflows: bump crazy-max/ghaction-import-gpg from 5 to 6 (#7908)
dependabot[bot] Sep 11, 2023
643e5c5
tests: internal: log_event_decoder: add test for log_event_decoder
nokute78 Sep 10, 2023
8b0e4fa
out_forward: add new 'add_option' configuration property
edsiper Sep 5, 2023
ccbe569
workflows: bump docker/metadata-action from 4 to 5 (#7916)
dependabot[bot] Sep 13, 2023
c8f0f60
workflows: bump docker/build-push-action from 4 to 5 (#7915)
dependabot[bot] Sep 13, 2023
44558d8
workflows: bump docker/setup-qemu-action from 2 to 3 (#7913)
dependabot[bot] Sep 13, 2023
9c78785
workflows: bump docker/login-action from 2 to 3 (#7912)
dependabot[bot] Sep 13, 2023
7d25ed2
workflows: bump docker/setup-buildx-action from 2 to 3 (#7914)
dependabot[bot] Sep 13, 2023
5e52565
in_calyptia_fleet: improve configuration reloading. (#7925)
pwhelan Sep 18, 2023
bda170b
kernel: add release function
nokute78 Sep 18, 2023
0ff2a69
config: release kernel info using flb_kernel_destroy
nokute78 Sep 18, 2023
142e1d1
out_loki: add compress option for gzip (#7949)
ksauzz Sep 21, 2023
4a1bf9c
lib: monkey: upgrade to v1.7.2 (#7951)
pwhelan Sep 21, 2023
37fddf7
docs: replace tab with white space (#7932)
nokute78 Sep 21, 2023
9664fb5
tests: internal: uri: add test
nokute78 Sep 17, 2023
f3c87e2
uri: not allow negative pos
nokute78 Sep 17, 2023
e7c2d4f
config: reload: Save and increment the count of hot-reloaded times
cosmo0920 Sep 6, 2023
2fea5a3
http_server: v2: reload: Provide GET endpoint to retrieve the count o…
cosmo0920 Sep 6, 2023
7e16bf9
metrics: Add hot-reloaded metrics
cosmo0920 Sep 6, 2023
eba37f0
http_server: v2: reload: Use more concrate key for storing reloaded t…
cosmo0920 Sep 6, 2023
109332d
fluent-bit: use console ctrl handlers in win32 to simulate SIGHUP.
pwhelan Sep 13, 2023
a834007
in_calyptia_fleet: reenable fleet on windows.
pwhelan Sep 13, 2023
931d2bb
in_calyptia_fleet: use GenerateConsoleCtrlEvent on win32 to execute r…
pwhelan Sep 13, 2023
046ed56
in_calyptia_fleet: add support for creating configuration files for w…
pwhelan Sep 13, 2023
b84459b
fluent-bit: fix indentation.
pwhelan Sep 15, 2023
4b06006
fluent-bit: follow PHANDLER_ROUTINE definition more closely.
pwhelan Sep 15, 2023
de2f8f2
in_calyptia_fleet: add readlink equivalent for windows.
pwhelan Sep 20, 2023
2413610
lib: chunkio: upgrade to v1.5.0
edsiper Sep 21, 2023
b78b05a
storage: added chunkio options structure initialization and trim support
Sep 21, 2023
3de9cb9
storage: added chunkio options structure initialization
Sep 21, 2023
3547fb1
tests: added chunkio options structure initialization
Sep 21, 2023
1a1bf05
config: added chunkio trimming support
Sep 21, 2023
b699614
out_http: Fix bug where post_all_requests() always returns a value le…
nicehide Sep 21, 2023
fdb3adf
out_oracle_log_analytics: add new Oracle log analytics connector (#7830)
adiforluls Sep 22, 2023
5610789
engine: add sleep to output logs on init (#7931)
nokute78 Sep 22, 2023
2356fad
scheduler: use calloc instead of malloc (#7962)
DavidKorczynski Sep 23, 2023
a61088b
plugin_proxy: Handle no ingestion case (#7922)
cosmo0920 Sep 23, 2023
85f1d40
input_chunk: Use flb_plg_debug instead of normal printf (#7901)
cosmo0920 Sep 23, 2023
0f11279
lua: push flb_null as a nil value
nokute78 Sep 8, 2023
de86207
tests: runtime: lua: test for enable_flb_null
nokute78 Sep 8, 2023
c864fd3
filter_lua: support enable_flb_null
nokute78 Sep 8, 2023
60f73cb
upstream: remove unused var
nokute78 Jul 29, 2023
5c4a701
input_chunk: remove unused var
nokute78 Jul 29, 2023
a4a04e3
tests: runtime: filter_lua: add test for empty array and metatable
nokute78 Sep 2, 2023
51723c9
lua: support metatable to save table type
nokute78 Sep 2, 2023
43ebe08
filter_log_to_metrics: Add setting "label" (#7739)
wndhydrnt Sep 23, 2023
ab626d0
filter_log_to_metrics: rename 'label' option to 'add_label' (#7964)
edsiper Sep 23, 2023
d2021f7
out_azure: improvement: add table prefix support for Azure Log Analyt…
kforeverisback Sep 23, 2023
566eb09
out_logdna: remove unused store (#7629)
DavidKorczynski Sep 23, 2023
6657dc9
out_azure_logs_ingestion: fix NULL dereference (#7624)
DavidKorczynski Sep 23, 2023
95d3df1
tests: internal: fuzzers: add fstore fuzzer (#6465)
DavidKorczynski Sep 23, 2023
3a4df53
log_event_encoder: fix typo (#7646)
nokute78 Sep 23, 2023
2a0b25c
in_systemd: init last_tag to fix valgrind warning (#7247)
nokute78 Sep 23, 2023
859987b
config: support sp.convert_from_str_to_num
nokute78 Mar 5, 2023
a3aa6e1
sp: prevent converting from string to num if config is set
nokute78 Mar 11, 2023
fa30a2b
tests: internal: sp: add test case for conv_from_str_to_num
nokute78 Mar 18, 2023
3b6d903
out_es: check if host contains port number
nokute78 Sep 16, 2022
df1ad29
tests: internal: input_chunk: Use the different storage.path per tests
cosmo0920 Jul 27, 2023
6bb2a12
tests: fuzzers: fix fstore div-by-zero
DavidKorczynski Sep 26, 2023
183f0d4
filter_log_to_metrics: process the 'add_label' property, which was re…
pwhelan Sep 25, 2023
10e4d87
filter_log_to_metrics: fix label test to use 'add_label'.
pwhelan Sep 25, 2023
ea3c083
tests: internal: stream_processor: fixed memory leak
Sep 26, 2023
9c53a79
tests: internal: stream_processor: fixed memory leak
Sep 26, 2023
32379cb
tests: internal: sp: added environment initialization calls
Sep 25, 2023
23d8bfc
config_format: fix memory leak
DavidKorczynski Sep 22, 2023
95e9e39
config_format: adjust leak fix
DavidKorczynski Sep 26, 2023
c731953
tests: fuzzers: fix possible NULL deref
DavidKorczynski Sep 26, 2023
46748f7
log_event_encoder: switched data size type to overcome msvc issue
Sep 25, 2023
1e04bae
log_event_encoder: switched data size type to overcome msvc issue
Sep 26, 2023
2060c09
log_event_encoder: fixed 64 bit integer corner case
Sep 27, 2023
17dc353
release: update to 2.1.11 (#7987)
github-actions[bot] Sep 28, 2023
7973154
build: bump to v2.2.0
edsiper Sep 28, 2023
8aecfc8
bitbake: bump to v2.2.0
edsiper Sep 28, 2023
aff8811
dockerfile: bump to v2.2.0
edsiper Sep 28, 2023
639bc24
bin: windows: Restore Ctrl-C behavior on windows
cosmo0920 Sep 28, 2023
e8579a9
bin: Fix build on non-Windows
cosmo0920 Sep 28, 2023
e2e6175
documentation: update users graphic (#7999)
erikbledsoe Oct 3, 2023
d160ab9
Merge branch 'master' into leonardo-master-filesystem-access-abstract…
Oct 5, 2023
7427038
file: fixed a typo
Oct 5, 2023
13ca67a
out_oracle_log_analytics: updated file read function name
Oct 5, 2023
53cd3ca
in_node_exporter_metrics: reverted an accidental regression
Oct 5, 2023
5a5bf9f
file_unix: allocate path from the heap
edsiper Jun 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tests: internal: sp: add test case for conv_from_str_to_num
Signed-off-by: Takahiro Yamashita <nokute78@gmail.com>
  • Loading branch information
nokute78 authored and Leonardo Alminana committed Oct 5, 2023
commit fa30a2b1ef932095a268b7e3fdbfb835a950dee8
139 changes: 136 additions & 3 deletions tests/internal/stream_processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
#include <fluent-bit/flb_pack.h>
#include <fluent-bit/flb_error.h>
#include <fluent-bit/flb_router.h>
#include <fluent-bit/flb_storage.h>
#include <fluent-bit/stream_processor/flb_sp.h>
#include <fluent-bit/stream_processor/flb_sp_parser.h>
#include <fluent-bit/stream_processor/flb_sp_stream.h>
#include <fluent-bit/stream_processor/flb_sp_window.h>
#include <msgpack.h>

#include "flb_tests_internal.h"
#include "include/sp_invalid_queries.h"
Expand Down Expand Up @@ -107,7 +109,7 @@ int flb_sp_do_test(struct flb_sp *sp, struct flb_sp_task *task,
if (task->aggregate_keys == FLB_TRUE) {
ret = sp_process_data_aggr(data_buf->buffer, data_buf->size,
tag, tag_len,
task, sp);
task, sp, FLB_TRUE);
if (ret == -1) {
flb_error("[sp] error error processing records for '%s'",
task->name);
Expand All @@ -119,8 +121,7 @@ int flb_sp_do_test(struct flb_sp *sp, struct flb_sp_task *task,
task->name);
return -1;
}

if (task->window.type == FLB_SP_WINDOW_DEFAULT) {
if (task->window.type == FLB_SP_WINDOW_DEFAULT || task->window.type == FLB_SP_WINDOW_TUMBLING) {
package_results(tag, tag_len, &out_buf->buffer, &out_buf->size, task);
}

Expand Down Expand Up @@ -751,11 +752,143 @@ static void test_snapshot()
#endif
}

static void test_conv_from_str_to_num()
{
struct flb_config *config = NULL;
struct flb_sp *sp = NULL;
struct flb_sp_task *task = NULL;
struct sp_buffer out_buf;
struct sp_buffer data_buf;
msgpack_sbuffer sbuf;
msgpack_packer pck;
msgpack_unpacked result;
size_t off = 0;
char json[4096] = {0};
int ret;

#ifdef _WIN32
WSADATA wsa_data;

WSAStartup(0x0201, &wsa_data);
#endif
out_buf.buffer = NULL;

config = flb_config_init();
config->evl = mk_event_loop_create(256);

ret = flb_storage_create(config);
if (!TEST_CHECK(ret == 0)) {
TEST_MSG("flb_storage_create failed");
flb_config_exit(config);
return;
}

sp = flb_sp_create(config);
if (!TEST_CHECK(sp != NULL)) {
TEST_MSG("[sp test] cannot create stream processor context");
goto test_conv_from_str_to_num_end;
}

task = flb_sp_task_create(sp, "tail.0", "CREATE STREAM test WITH (tag=\'test\') AS SELECT word, num, COUNT(*) FROM STREAM:tail.0 WINDOW TUMBLING (1 SECOND) GROUP BY word, num;");
if (!TEST_CHECK(task != NULL)) {
TEST_MSG("[sp test] wrong check 'conv', fix it!");
goto test_conv_from_str_to_num_end;
}

/* Create input data */
msgpack_sbuffer_init(&sbuf);
msgpack_packer_init(&pck, &sbuf, msgpack_sbuffer_write);
msgpack_pack_array(&pck, 2);
flb_pack_time_now(&pck);
msgpack_pack_map(&pck, 2);

msgpack_pack_str(&pck, 4);
msgpack_pack_str_body(&pck, "word", 4);
msgpack_pack_str(&pck, 4);
msgpack_pack_str_body(&pck, "hoge", 4);

msgpack_pack_str(&pck, 3);
msgpack_pack_str_body(&pck, "num", 3);
msgpack_pack_str(&pck, 6);
msgpack_pack_str_body(&pck, "123456", 6);

data_buf.buffer = sbuf.data;
data_buf.size = sbuf.size;

out_buf.buffer = NULL;
out_buf.size = 0;

/* Exec stream processor */
ret = flb_sp_do_test(sp, task, "tail.0", strlen("tail.0"), &data_buf, &out_buf);
if (!TEST_CHECK(ret == 0)) {
TEST_MSG("flb_sp_do_test failed");
msgpack_sbuffer_destroy(&sbuf);
goto test_conv_from_str_to_num_end;
}

if (!TEST_CHECK(out_buf.size > 0)) {
TEST_MSG("out_buf size is 0");
msgpack_sbuffer_destroy(&sbuf);
goto test_conv_from_str_to_num_end;
}


/* Check output buffer. It should contain a number 123456 not a string "123456" */

msgpack_unpacked_init(&result);
ret = msgpack_unpack_next(&result, out_buf.buffer, out_buf.size, &off);
if (!TEST_CHECK(ret == MSGPACK_UNPACK_SUCCESS)) {
TEST_MSG("failed to unpack ret=%d", ret);
msgpack_unpacked_destroy(&result);
msgpack_sbuffer_destroy(&sbuf);
goto test_conv_from_str_to_num_end;
}

ret = flb_msgpack_to_json(&json[0], sizeof(json), &result.data);
if (!TEST_CHECK(ret > 0)) {
TEST_MSG("flb_msgpack_to_json failed");
msgpack_unpacked_destroy(&result);
msgpack_sbuffer_destroy(&sbuf);
goto test_conv_from_str_to_num_end;
}

if (!TEST_CHECK(strstr(json,"123456") != NULL)) {
TEST_MSG("number not found");
msgpack_unpacked_destroy(&result);
msgpack_sbuffer_destroy(&sbuf);
goto test_conv_from_str_to_num_end;
}
if (!TEST_CHECK(strstr(json,"\"123456\"") == NULL)) {
TEST_MSG("output should be number type");
msgpack_unpacked_destroy(&result);
msgpack_sbuffer_destroy(&sbuf);
goto test_conv_from_str_to_num_end;
}

msgpack_unpacked_destroy(&result);
msgpack_sbuffer_destroy(&sbuf);

test_conv_from_str_to_num_end:
if (out_buf.buffer != NULL) {
flb_free(out_buf.buffer);
}

#ifdef _WIN32
WSACleanup();
#endif
if (sp != NULL) {
flb_sp_destroy(sp);
}
flb_storage_destroy(config);
flb_config_exit(config);
}

TEST_LIST = {
{ "invalid_queries", invalid_queries},
{ "select_keys", test_select_keys},
{ "select_subkeys", test_select_subkeys},
{ "window", test_window},
{ "snapshot", test_snapshot},
{ "conv_from_str_to_num", test_conv_from_str_to_num},
{ NULL }
};