Match is only working for * and I dont see why this is happening. Here are my config.
lua
function process_record(tag, timestamp, record)
print("Input tag: ", tag)
print("Record: ", record["tag"])
local s3_log = {}
local cw_log = {}
for k, v in pairs(record) do
cw_log[k] = v
cw_log["tag"] = "cw"
s3_log[k] = v
s3_log["tag"] = "s3"
end
print("S3 tag: ", s3_log["tag"])
print("CW tag: ", cw_log["tag"])
print("S3 Log: ", s3_log["log"])
print("CW Log: ", cw_log["log"])
return 2, timestamp, {s3_log, cw_log}
end
config
[SERVICE]
flush 1
daemon off
log_level debug
[FILTER]
Name lua
Match *
script /append_tag.lua
call process_record
[FILTER]
Name lua
Match $tag cw
script /print.lua
call process_record
[FILTER]
Name rewrite_tag
Match cw
Rule $tag .* cw true
Emitter_Name cw_emitted
[OUTPUT]
Name cloudwatch_logs
Match *cw*
# Match *
# Match_regex ^(cw)$
log_key log
region af-south-1
log_group_name /ecs/log
log_stream_prefix fluent-bit-
auto_create_group On
log_format json/emf
Additional Information:
Fluent Bit version: AWS_FOR_FLUENT_BIT_VERSION 2.32.2.20240627
AWS Fargate setup
Using log_router containers