Skip to content

Intermittent lib data invalid errors when pushing data via flb_lib_push() from C# #11081

@PraveenJeffriAndroidDeveloper

Description

Hi team,

I’m using Fluent Bit as an embedded library inside a C# application.
I’m pushing event data directly using flb_lib_push(), but I’m seeing frequent log messages saying

[2025/10/29 10:49:48] [ warn] [input:lib:lib.0] lib data invalid

For the first 5 minutes(this is random sometime can be 1 hour), everything runs normally and all records are ingested successfully.
After that, the errors start appearing. There are no exceptions on the C# side — everything seems to push normally.

`
public static void PushData(int inputId, IEvent data)
{
try
{
long unixTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
string jsonMap = JsonConvert.SerializeObject(data);

    var metadata = new Dictionary<string, dynamic>
    {
        { "ObservedTimestamp", data.ObservedTime },
        { "Timestamp", data.Time },
        { "TraceId", data.TraceId },
        { "SpanId", data.SpanId }
    };

    var serializedMetaData = JsonConvert.SerializeObject(metadata);

    string payload = $"[[{unixTime}, {serializedMetaData}], {jsonMap}]";

    var bytes = Encoding.UTF8.GetBytes(payload);
    FluentBitPInvoke.flb_lib_push(_ctx, inputId, bytes, bytes.Length);
}
catch (Exception ex)
{
    Globals.Logger.Error($"[FB PushData] {ex.Message}");
}

}
`

Observed behavior:

  • Some records go through successfully.
  • Others fail and cause Fluent Bit to print [lib] data invalid.
  • This happens randomly

Expected behavior
All events should be accepted and processed without showing lib data invalid.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions