Skip to content

Instantly share code, notes, and snippets.

@identw
Created September 24, 2025 12:50
Show Gist options
  • Save identw/24ed125095585105eb3a2a2a2d2acb91 to your computer and use it in GitHub Desktop.
Save identw/24ed125095585105eb3a2a2a2d2acb91 to your computer and use it in GitHub Desktop.
flient-bit configs
function cb(tag, timestamp, record)
new_record = record
-- for nginx ingress access log
if record["kubernetes"]["labels"]["app.kubernetes.io/name"] == "ingress-nginx" and record["stream"] == "stdout" then
new_record["tag"] = "kube_nginx_ingress_stdout"
return 2, timestamp, new_record
end
if record["log"] == nil then
new_record["log"] = " "
end
-- for other logs
if record["log"] ~= nil and record["log"]["REQUEST_ID"] ~= nil then
new_record["request_id"] = record["log"]["REQUEST_ID"]
new_record["log"]["REQUEST_ID"] = nil
else
new_record["request_id"] = ""
end
new_record["app_namespace"] = record["kubernetes"]["namespace_name"]
return 2, timestamp, new_record
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment