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

in_forward: Support empty_shared_key parameter #9681

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

cosmo0920
Copy link
Contributor

@cosmo0920 cosmo0920 commented Dec 3, 2024

This is unsupported case of the specification of classic format and yaml format of fluent-bit configuration.
In out_forward plugin, we already had supported empty_shared_key parameter.
However, in_forward plugin does not support such parameter in the current master.

I implemented empty_shared_key parameter in in_forward plugin.


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
pipeline:
  inputs:
    - name: forward
      alias: Forward
      listen: 0.0.0.0
      port: "24225"
      empty_shared_key: on
      tls: on
      tls.verify: on
      tls.debug: "1"
      tls.crt_file: /path/to/ca_cert.pem
      tls.key_file: /path/to/ca_key.pem
      tls.key_passwd: fluentd
      tag: forwarded.from.fluentd
      processors:
         logs:
            - name: lua
              call: append_tag
              code: |
                     function append_tag(tag, timestamp, record)
                     new_record = record
                     new_record["tag"] = tag
                     return 1, timestamp, new_record
                     end
  outputs:
    - name: stdout
      format: json
      Match: '*'
  • Debug log output from testing the change
Fluent Bit v3.2.3
* Copyright (C) 2015-2024 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

______ _                  _    ______ _ _           _____  _____ 
|  ___| |                | |   | ___ (_) |         |____ |/ __  \
| |_  | |_   _  ___ _ __ | |_  | |_/ /_| |_  __   __   / /`' / /'
|  _| | | | | |/ _ \ '_ \| __| | ___ \ | __| \ \ / /   \ \  / /  
| |   | | |_| |  __/ | | | |_  | |_/ / | |_   \ V /.___/ /./ /___
\_|   |_|\__,_|\___|_| |_|\__| \____/|_|\__|   \_/ \____(_)_____/


[2024/12/06 15:35:36] [ info] Configuration:
[2024/12/06 15:35:36] [ info]  flush time     | 1.000000 seconds
[2024/12/06 15:35:36] [ info]  grace          | 5 seconds
[2024/12/06 15:35:36] [ info]  daemon         | 0
[2024/12/06 15:35:36] [ info] ___________
[2024/12/06 15:35:36] [ info]  inputs:
[2024/12/06 15:35:36] [ info]      forward
[2024/12/06 15:35:36] [ info] ___________
[2024/12/06 15:35:36] [ info]  filters:
[2024/12/06 15:35:36] [ info] ___________
[2024/12/06 15:35:36] [ info]  outputs:
[2024/12/06 15:35:36] [ info]      stdout.0
[2024/12/06 15:35:36] [ info] ___________
[2024/12/06 15:35:36] [ info]  collectors:
[2024/12/06 15:35:36] [ info] [fluent bit] version=3.2.3, commit=48d52cc47c, pid=209374
[2024/12/06 15:35:36] [debug] [engine] coroutine stack size: 24576 bytes (24.0K)
[2024/12/06 15:35:36] [ info] [storage] ver=1.1.6, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2024/12/06 15:35:36] [ info] [simd    ] disabled
[2024/12/06 15:35:36] [ info] [cmetrics] version=0.9.9
[2024/12/06 15:35:36] [ info] [ctraces ] version=0.5.7
[2024/12/06 15:35:36] [ info] [input:forward:Forward] initializing
[2024/12/06 15:35:36] [ info] [input:forward:Forward] storage_strategy='memory' (memory only)
[2024/12/06 15:35:36] [debug] [forward:Forward] created event channels: read=25 write=26
[2024/12/06 15:35:36] [debug] [in_fw] Listen='0.0.0.0' TCP_Port=24224
[2024/12/06 15:35:36] [debug] [downstream] listening on 0.0.0.0:24224
[2024/12/06 15:35:36] [ info] [input:forward:Forward] listening on 0.0.0.0:24224
[2024/12/06 15:35:36] [debug] [stdout:stdout.0] created event channels: read=28 write=29
[2024/12/06 15:35:36] [ info] [sp] stream processor started
[2024/12/06 15:35:36] [ info] [output:stdout:stdout.0] worker #0 started
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: before SSL initialization
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: before SSL initialization
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: SSLv3/TLS read client hello
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: SSLv3/TLS write server hello
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: SSLv3/TLS write certificate
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: SSLv3/TLS write key exchange
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: SSLv3/TLS write certificate request
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: SSLv3/TLS write server done
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: SSLv3/TLS write server done
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: SSLv3/TLS read client certificate
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: SSLv3/TLS read client key exchange
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: SSLv3/TLS read change cipher spec
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: SSLv3/TLS read finished
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: SSLv3/TLS write session ticket
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: SSLv3/TLS write change cipher spec
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL_accept: SSLv3/TLS write finished
[2024/12/06 15:35:44] [debug] [input:forward:Forward] protocol: sending HELO
[2024/12/06 15:35:44] [debug] [input:forward:Forward] protocol: checking PING
[2024/12/06 15:35:44] [debug] [input:forward:Forward] protocol: received PING
[2024/12/06 15:35:44] [debug] [input:forward:Forward] protocol: sending PONG
[2024/12/06 15:35:44] [debug] [input:forward:Forward] concatenated gzip payload count is 0
[2024/12/06 15:35:44] [debug] [tls] connection #48 SSL3 alert read:warning:close notify
[2024/12/06 15:35:44] [debug] [socket] could not validate socket status for #48 (don't worry)
[2024/12/06 15:35:45] [debug] [task] created task=0x7b3c9d0 id=0 OK
[{"date":1733466939.226009,"tailed_path":"./test.log","tag":"forward.raw","message":"Hi from FLuentd"}][2024/12/06 15:35:45] [debug] [output:stdout:stdout.0] task_id=0 assigned to thread #0

[2024/12/06 15:35:45] [debug] [out flush] cb_destroy coro_id=0
[2024/12/06 15:35:45] [debug] [task] destroy task=0x7b3c9d0 (task_id=0)
^C[2024/12/06 15:35:46] [engine] caught signal (SIGINT)
[2024/12/06 15:35:46] [ warn] [engine] service will shutdown in max 5 seconds
[2024/12/06 15:35:46] [ info] [input] pausing Forward
[2024/12/06 15:35:47] [ info] [engine] service has stopped (0 pending tasks)
[2024/12/06 15:35:47] [ info] [input] pausing Forward
[2024/12/06 15:35:47] [ info] [output:stdout:stdout.0] thread worker #0 stopping...
[2024/12/06 15:35:47] [ info] [output:stdout:stdout.0] thread worker #0 stopped
  • Attached Valgrind output that shows no leaks or memory corruption was found
==209374== 
==209374== HEAP SUMMARY:
==209374==     in use at exit: 0 bytes in 0 blocks
==209374==   total heap usage: 17,764 allocs, 17,764 frees, 3,963,567 bytes allocated
==209374== 
==209374== All heap blocks were freed -- no leaks are possible
==209374== 
==209374== For lists of detected and suppressed errors, rerun with: -s
==209374== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

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

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

Documentation

  • Documentation required for this feature

fluent/fluent-bit-docs#1525

Backporting

  • Backport to latest stable release.

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.

@cosmo0920 cosmo0920 force-pushed the cosmo0920-handle-empty-shared-key branch from 2acc449 to 7aaeebe Compare December 3, 2024 13:01
@cosmo0920 cosmo0920 force-pushed the cosmo0920-handle-empty-shared-key branch from 7aaeebe to 883242c Compare December 3, 2024 14:05
@cosmo0920 cosmo0920 changed the title in_forward: Handle '' and "" or absent value for yaml value as an empty shared_key in_forward: Support empty_shared_key parameter Dec 3, 2024
@RicardoAAD
Copy link
Collaborator

Tested the PR and it is working as expected.
Thanks @cosmo0920 Do we know when this can be merged/released?

@cosmo0920
Copy link
Contributor Author

Thanks @cosmo0920 Do we know when this can be merged/released?

Currently, we don't have any ETA for the next release of Fluent Bit 3.2.
Maybe the middle of December or so?

plugins/in_forward/fw_config.c Outdated Show resolved Hide resolved
@cosmo0920 cosmo0920 force-pushed the cosmo0920-handle-empty-shared-key branch from 883242c to fcda579 Compare December 6, 2024 06:34
@edsiper edsiper merged commit 412d3ea into master Dec 6, 2024
49 of 51 checks passed
@edsiper edsiper deleted the cosmo0920-handle-empty-shared-key branch December 6, 2024 14:28
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.

3 participants