Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bob-common/mkosi.extra/etc/fluent-bit/delay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- Lua script stays in memory for the lifetime of the Fluent Bit process,
-- so all local variables persist across filter calls.

local DELAY_SEC = 300 -- Delay (in seconds) before flushing logs
local DELAY_SEC = 30 -- Delay (in seconds) before flushing logs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that intended change? I'll cherry-pick other two hunks into #43

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely not intended, lol

local buckets = {} -- Table to bucket logs by their timestamp (seconds)
local earliest_sec = nil -- Tracks the earliest second we have in our buckets table
local last_processed_second = nil -- Tracks which second we last ran the flush logic on
Expand All @@ -26,7 +26,7 @@ function log_delay(tag, ts_table, record)
-- 2) Check if we've already processed this second
if last_processed_second == now_floor then
-- Skip the flush; Return no output
return 2, ts_table, {}
return -1, ts_table, {}
end

-- 3) Otherwise, do the flush logic once for this second
Expand All @@ -49,7 +49,7 @@ function log_delay(tag, ts_table, record)

-- 4) Return any flushed logs
if #to_emit == 0 then
return 2, ts_table, {}
return -1, ts_table, {}
else
local new_ts = { sec = now_sec, nsec = 0 }
return 1, new_ts, to_emit
Expand Down