Andrew Longwill
06/12/2025, 1:51 PM{"msg"=>"doing something", "cluster"=>"my-awesome-cluster", "log"=>"{"colour":"blue"}"}
What is the best way to modify log->colour if I want to rename that to "foo"?
I have a solution using lua like this:
function rename_field(tag, timestamp, record)
if record["log"] then
record["log"] = string.gsub(record["log"], '"colour"', '"foo"')
end
return 1, timestamp, record
end
Tried using cjson but looks like that it's not available in the default Docker imagePat
06/12/2025, 1:55 PMAndrew Longwill
06/12/2025, 1:55 PMPat
06/12/2025, 1:55 PMPat
06/12/2025, 2:00 PMAndrew Longwill
06/12/2025, 2:54 PMCondition but not actually changing values 🙂 (been digging into this a lot today 😅 )Pat
06/12/2025, 2:54 PMPat
06/12/2025, 2:55 PMPat
06/12/2025, 2:55 PMAndrew Longwill
06/12/2025, 3:45 PM"log"=>"{"colour":"blue", "foo":"bar"}
to a map
"log"=>"{"colour"=>"blue", "foo"=>"bar"}Andrew Longwill
06/12/2025, 3:47 PMlog do eventually become fields in the log entry in Victoria Logs. It's not clear to me as to how/when that happens in the pipeline 😅Pat
06/12/2025, 3:47 PMPat
06/12/2025, 3:48 PMPat
06/12/2025, 3:49 PMparser filter though to parse individual keys: https://docs.fluentbit.io/manual/pipeline/filters/parser
Typically you do this anyway ingesting logs from kubelet format first and then into app-specific formatsAndrew Longwill
06/12/2025, 3:59 PM