How to extract TAG components and add them as attributes to the record? #8657
Replies: 3 comments 1 reply
-
I also seem to be having a bit of trouble finding where in the documentation I should be looking for this. In my case, I'm using the fluentd logging engine in Docker to ship my logs to a fluent-bit instance: Terraform config log_configuration = {
logDriver = "fluentd"
options = {
"fluentd-address" = "localhost:24224",
"tag" = "xonboard_backend2"
}
secretOptions = null
} I then want to extract the tag that's been passed and set it as the
In fluentd this was as possible using |
Beta Was this translation helpful? Give feedback.
-
hi.
|
Beta Was this translation helpful? Give feedback.
-
For anyone coming here wishing to simply extract the full tag and add it as a field to the record, the example here in the docs seems to do this - reproducing the yaml config here in case the link breaks in future: pipeline:
inputs:
...
filters:
- name: lua
match: "*"
call: append_tag
code: |
function append_tag(tag, timestamp, record)
new_record = record
new_record["tag"] = tag
return 1, timestamp, new_record
end This allows you to then reference outputs:
- name: opensearch
logstash_format: on
logstash_prefix_key: tag
logstash_dateformat: 'mycustomsuffix' # deliberately don't include any strfime format symbols to exclude the date which results in dynamic index names based on the tag, e.g. the above produces: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! I searched in github and surprisingly I did not find this pattern, that should be pretty common.
I have a tag that has the following pattern:
How do I add
<PROCESS_NAME>
as attribute to the record?E.g. I want to produce the following record:
Beta Was this translation helpful? Give feedback.
All reactions