Custom Lua

Custom Lua

The custom Lua processing rule allows you to write a function that can be called for all records passing through a pipeline.

The following is a snippet of the Lua code that is included by default

-- The function below has an API similar to that of fluent-bit Lua scripts.
-- The main exception is the extra paramenter `code`, which contains the value
-- returned by the previous processing rule.
--
-- See https://docs.fluentbit.io/manual/pipeline/filters/lua for details.
return function(tag, ts, record, code)
  -- Add statements before the "return" line.
  -- You can access a certain field ("field_a" for example) in
  -- using "record.field_a" or "record['field_a']".
  --
  -- Here's a simple example that concatenates "key_one" and "key_two" to
  -- a new field named "key_three"
  --
  --    record.key_three = tostring(record.key_one) .. tostring(record.key_two)
  return code, ts, record
end

Last updated