Arthur.h
05/14/2025, 2:58 PMuserEmail field to a log record by extracting it from the headers.Cookie field:
<filter {kube.var.log.containers.traefik-**}>
@type record_modifier
<record>
userEmail ${record["headers.Cookie"]&.match(/[^|]+@[^|]+/)}
</record>
</filter>
The Fluent Bit record_modifier plugin doesn't support the Ruby code that Fluentd uses. If I understand correctly, I should use a similar Lua script to handle this case :
function extract_email(tag, timestamp, record)
local cookie = record["headers.Cookie"]
if cookie ~= nil then
local email = string.match(cookie, "[^|]+@[^|]+")
if email ~= nil then
record["userEmail"] = email
end
end
return 1, timestamp, record
end
This leads me to two questions:
• Am I right in thinking that Lua scripting is the correct solution here, or have I missed an appropriate configuration available in existing plugins?
• Is Lua scripting the general fallback for cases not supported by plugins, or should it be avoided (e.g., because it's not the intended way to use the tool or could cause performance issues)?Anurag Gupta
05/15/2025, 8:23 PMAnurag Gupta
05/15/2025, 8:23 PMAnurag Gupta
05/15/2025, 8:24 PMAnurag Gupta
05/15/2025, 8:24 PMArthur.h
05/16/2025, 9:24 AM