Getting More Out of Lua in Fluent Bit
summary
Explains exact Lua filter mechanics in Fluent Bit: the three function arguments (tag, timestamp, record), the four return codes (-1 drop, 0 nop, 1 replace ts+record, 2 replace record), and concrete fixes for timestamp precision using time_as_table (sec/nsec), padding fractional nsec, and formatting UTC human-readable timestamps. Shows how to inject a collector_timestamp, why unparsed input forces Fluent Bit to generate processing timestamps, recommends local variables over globals, separate Lua files per filter, and notes Fluent Bit embeds LuaJIT (Lua 5.1) so newer Lua features aren’t available.
AI-written summary · about
chapters (9)
- 0:00Start
- 1:09Motivation
- 3:01Basics
- 5:24Example: Replace record timestamp
- 8:22Example: Generate collector timestamp
- 18:45Tips
- 19:01Tip: Truthiness
- 19:54Tip: Minimize main function contents
- 21:25Tip: Minimize file contents
related talks
26mNoise Cancelling Headphones for Fluent Bit - Powered by Lua
30mFluent Bit, the engine to power Chat Ops
36mDeep Dive: Fluent Bit
25mLessons From Five+ Years of Fluent Bit: Building a Global-Scale Observability Agent
40mLive, Laugh, Log
06mFluent Bit V5
22mFluent Bit - Swiss Army Tool of Observability Data Ingestion
22mLogging: Fluentd & Fluent Bit
