Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter_multiline: use flb_time API to get timestamp in millisecond #5638

Merged
merged 1 commit into from
Jul 3, 2022

Conversation

nokute78
Copy link
Collaborator

This patch is to suppress below warning.
I modified to use flb_time API since gettimeofday is not supported on Windows.

[ 44%] Building C object plugins/filter_multiline/CMakeFiles/flb-plugin-filter_multiline.dir/ml_concat.c.o
/home/taka/git/fluent-bit/plugins/filter_multiline/ml_concat.c: In function ‘ml_current_timestamp’:
/home/taka/git/fluent-bit/plugins/filter_multiline/ml_concat.c:330:5: warning: implicit declaration of function ‘gettimeofday’ [-Wimplicit-function-declaration]
  330 |     gettimeofday(&te, NULL);
      |     ^~~~~~~~~~~~

Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • [N/A] Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

Documentation

  • [N/A] Documentation required for this feature

Backporting

  • [N/A] Backport to latest stable release.

Debug log / Valgrind output

$ valgrind --leak-check=full bin/flb-rt-filter_multiline 
==15100== Memcheck, a memory error detector
==15100== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==15100== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==15100== Command: bin/flb-rt-filter_multiline
==15100== 
Test multiline_buffered_one_record...           [2022/06/25 07:23:15] [ info] [fluent bit] version=1.9.6, commit=1bec2348e1, pid=15100
[2022/06/25 07:23:15] [ info] [storage] version=1.2.0, type=memory-only, sync=normal, checksum=disabled, max_chunks_up=128
[2022/06/25 07:23:15] [ info] [cmetrics] version=0.3.4
[2022/06/25 07:23:15] [ info] [filter:multiline:multiline.0] created emitter: emitter_for_multiline.0
[2022/06/25 07:23:15] [ info] [sp] stream processor started
[2022/06/25 07:23:15] [ info] [filter:multiline:multiline.0] created new multiline stream for lib.0_test
(snip)
Test flb_test_multiline_partial_message_concat_two_ids... [2022/06/25 07:23:34] [ info] [fluent bit] version=1.9.6, commit=1bec2348e1, pid=15100
[2022/06/25 07:23:34] [ info] [storage] version=1.2.0, type=memory-only, sync=normal, checksum=disabled, max_chunks_up=128
[2022/06/25 07:23:34] [ info] [cmetrics] version=0.3.4
[2022/06/25 07:23:34] [ info] [filter:multiline:multiline.0] created emitter: emitter_for_multiline.0
[2022/06/25 07:23:34] [ info] [sp] stream processor started
[2022/06/25 07:23:36] [ warn] [engine] service will shutdown in max 1 seconds
[2022/06/25 07:23:37] [ info] [engine] service has stopped (0 pending tasks)
[ OK ]
SUCCESS: All unit tests have passed.
==15100== 
==15100== HEAP SUMMARY:
==15100==     in use at exit: 0 bytes in 0 blocks
==15100==   total heap usage: 6,166 allocs, 6,166 frees, 7,040,958 bytes allocated
==15100== 
==15100== All heap blocks were freed -- no leaks are possible
==15100== 
==15100== For lists of detected and suppressed errors, rerun with: -s
==15100== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)


Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Signed-off-by: Takahiro Yamashita <nokute78@gmail.com>
@edsiper edsiper merged commit e82e616 into fluent:master Jul 3, 2022
@nokute78 nokute78 deleted the fix_ml_concat_warn branch July 5, 2022 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants