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_sysinfo: add filter sysinfo plugin #8106

Merged
merged 1 commit into from
Nov 4, 2023

Conversation

nokute78
Copy link
Collaborator

This patch is to add a new plugin filter_sysinfo.
It is to add system information like hostname, os version and fluent-bit version.

Some properties are supported by specific platform.

Key Description Supported platform
fluentbit_version_key Specify the key name for fluent-bit version. All
os_name_key Specify the key name for os name. e.g. linux, win64 or macos. All
hostname_key Specify the key name for hostname. All
os_version_key Specify the key name for os version. It is not supported on some platforms. Linux
kernel_version_key Specify the key name for kernel version. It is not supported on some platforms. Linux

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:

  • 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.

  • [N/A] Run local packaging test showing all targets (including any new ones) build.
  • [N/A] Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

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

Configuration

[INPUT]
    Name dummy

[FILTER]
    Name sysinfo
    Match *
    fluentbit_version_key flb_ver
    os_name_key os
    hostname_key hostname
    os_version_key os_ver
    kernel_version_key os_ver

[OUTPUT]
    Name stdout
    Match *

Debug/Valgrind output

$ valgrind --leak-check=full bin/fluent-bit -c b.conf
==12559== Memcheck, a memory error detector
==12559== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==12559== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==12559== Command: bin/fluent-bit -c b.conf
==12559== 
Fluent Bit v2.2.0
* Copyright (C) 2015-2023 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2023/10/30 08:35:15] [ info] [fluent bit] version=2.2.0, commit=e590c8b221, pid=12559
[2023/10/30 08:35:15] [ info] [storage] ver=1.2.0, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2023/10/30 08:35:15] [ info] [cmetrics] version=0.6.4
[2023/10/30 08:35:15] [ info] [ctraces ] version=0.3.1
[2023/10/30 08:35:15] [ info] [input:dummy:dummy.0] initializing
[2023/10/30 08:35:15] [ info] [input:dummy:dummy.0] storage_strategy='memory' (memory only)
[2023/10/30 08:35:15] [ info] [output:stdout:stdout.0] worker #0 started
[2023/10/30 08:35:15] [ info] [sp] stream processor started
[0] dummy.0: [[1698622516.019936933, {}], {"message"=>"dummy", "flb_ver"=>"2.2.0", "os"=>"linux", "hostname"=>"taka-VirtualBox", "os_ver"=>"#35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct  6 10:23:26 UTC 2", "os_ver"=>"6.2.0-35-generic"}]
^C[2023/10/30 08:35:17] [engine] caught signal (SIGINT)
[0] dummy.0: [[1698622517.021173524, {}], {"message"=>"dummy", "flb_ver"=>"2.2.0", "os"=>"linux", "hostname"=>"taka-VirtualBox", "os_ver"=>"#35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct  6 10:23:26 UTC 2", "os_ver"=>"6.2.0-35-generic"}]
[2023/10/30 08:35:17] [ warn] [engine] service will shutdown in max 5 seconds
[2023/10/30 08:35:17] [ info] [input] pausing dummy.0
[2023/10/30 08:35:17] [ info] [engine] service has stopped (0 pending tasks)
[2023/10/30 08:35:17] [ info] [input] pausing dummy.0
[2023/10/30 08:35:18] [ info] [output:stdout:stdout.0] thread worker #0 stopping...
[2023/10/30 08:35:18] [ info] [output:stdout:stdout.0] thread worker #0 stopped
==12559== 
==12559== HEAP SUMMARY:
==12559==     in use at exit: 0 bytes in 0 blocks
==12559==   total heap usage: 1,788 allocs, 1,788 frees, 1,166,380 bytes allocated
==12559== 
==12559== All heap blocks were freed -- no leaks are possible
==12559== 
==12559== For lists of detected and suppressed errors, rerun with: -s
==12559== 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.

@nokute78 nokute78 temporarily deployed to pr October 29, 2023 23:53 — with GitHub Actions Inactive
@nokute78 nokute78 temporarily deployed to pr October 29, 2023 23:53 — with GitHub Actions Inactive
@nokute78 nokute78 temporarily deployed to pr October 29, 2023 23:53 — with GitHub Actions Inactive
@nokute78 nokute78 temporarily deployed to pr October 30, 2023 00:25 — with GitHub Actions Inactive
@nokute78
Copy link
Collaborator Author

nokute78 commented Nov 2, 2023

User requested #8052

@edsiper edsiper merged commit 517db0f into fluent:master Nov 4, 2023
41 checks passed
@nokute78 nokute78 deleted the filter_sysinfo branch November 5, 2023 09:18
@nokute78
Copy link
Collaborator Author

nokute78 commented Nov 5, 2023

Doc PR is fluent/fluent-bit-docs#1249

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