Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

Minimum setup to reproduce fluent-bit lua bug when returning an array with a null value

Notifications You must be signed in to change notification settings

Zimpler/fluent-bit-lua-array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fluent-bit demo: broken array output for lua filter

Lua returns broken output if given an array with a null key in it.

Steps to reproduce

Given the following input file with a JSON struture that contains an array with a null key in the middle:

// broken.json
{
  "hello": [1, null, "world"]
}

A no-op lua function that just returns its input:

function lua_noop(tag, timestamp, record)
    return 1, timestamp, record
end

And the following fluent-bit config that reads from stdin, filters through the lua no-op function, and output to sdout:

[INPUT]
    Name stdin

[FILTER]
    Name   lua
    Match  *
    Script /scripts/functions.lua
    Call   lua_noop

[OUTPUT]
    Name stdout
    Match *
    Format json_stream

You can run make after cloning this repo to test this setup.

When running this, I expect the following output:

{"date":1619774312.484865,"hello":[1,null,"world"]}

But instead get:

{"date":1619774347.885416,"hello":{1:1,3:"world"}}

Which is not valid JSON because the array is turned into an object with integer keys, and breaks downstream filters / outputs.

About

Minimum setup to reproduce fluent-bit lua bug when returning an array with a null value

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published