fluent / fluent/fluent-bit

Improve error logging for shared_key mismatch

Open Beginner friendly
#12,246 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
8.1k
Forks
2k
Avg merge
4d 20h
Merged PRs (30d)
71

Description

**Is your feature request related to a problem? Please describe.**

I use FluentBit with Forward input to receive data from remote FluentBit_s (many of them).
It so happened that I misconfigured several remote FluentBits with a wrong `shared_key` in FluentBit Forward Output.

I started getting error messages in the "receiving" FluentBit as below:

```
[2026/08/07 09:12:48.136] [error] [input:forward:forward.11] shared_key mismatch
[2026/08/07 09:12:48.136] [error] [input:forward:forward.11] handshake error checking PING
```

which indicated the problem but did not help to find where it comes from.

**Describe the solution you'd like**

It would be nice to modify FluentBit to print a remote IP address of a Client which triggered the message.

For my case, to test it, I modified this:
https://github.com/fluent/fluent-bit/blob/master/plugins/in_forward/fw_prot.c#L661
line to have it include `flb_connection_get_remote_address`:

```patch

diff --git a/plugins/in_forward/fw_prot.c b/plugins/in_forward/fw_prot.c
index fd35621f7..c18aabfc8 100644
--- a/plugins/in_forward/fw_prot.c
+++ b/plugins/in_forward/fw_prot.c
@@ -39,6 +39,7 @@

#include

+#include "fluent-bit/flb_connection.h"
#include "fw.h"
#include "fw_prot.h"
#include "fw_conn.h"
@@ -658,7 +659,7 @@ static int check_ping(struct flb_input_instance *ins,
}

if (strncmp(serverside, shared_key_digest, 128) != 0) {
- flb_plg_error(ins, "shared_key mismatch");
+ flb_plg_error(ins, "shared_key mismatch: %s", flb_connection_get_remote_address(conn->connection));
flb_free(serverside);

goto error;
```

I am not sure whether it is an acceptable solution or not but it gave me output as below (the IP address is not real):

```
[2026/08/07 09:12:48.136] [error] [input:forward:forward.11] shared_key mismatch: tcp://10.8.0.123:34682
[2026/08/07 09:12:48.136] [error] [input:forward:forward.11] handshake error checking PING
```
which allowed me to find the misconfigured host (logs producer).

I would like to request to include this or a similar solution to FluentBit.
It would be generally nice to have more "client metadata" in error and warning logs in other cases too.

**Describe alternatives you've considered**

I tried to use tcpdump to analyze traffic to discover the host with errors but with the fact that everything is TLS, it did not help.

**Additional context**

The problem is present in the current master branch commit 08609b6a8ea26b2b163ea486a640e7b0b3780e90 and I assume in any previous version.

Contributor guide

Open the contributing guide

Research direction

Start in plugins/in_forward/fw_prot.c at check_ping, where the shared_key mismatch is logged. Review the proposed use of flb_connection_get_remote_address with the connection object, then verify that the mismatch message identifies the remote client without disrupting the existing handshake error. Done means the Forward input reports the client address for this mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.