-
I'm currently trying to index into different indices on my configuration when using the Elasticsearch Sink. Like documented, I'm using a variable there: [sinks.elasticsearch.bulk]
index = "{{elastic_index}}-%Y-%m-%d-%H" The [transforms.add-elastic-index]
inputs = [ "remote-vector" ]
type = "remap"
drop_on_error = false
source = '''
if .msg_type != null {
elastic_index = .msg_type
del(.msg_type)
} else {
elastic_index = "cache-accesslogs"
}
''' I'm receiving this in the vector error log:
Apparently How can I pass the variable Is it possible to pass variables between the different stages, which are not part of the event? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @bebehei ! Variables defined in a |
Beta Was this translation helpful? Give feedback.
Hi @bebehei !
Variables defined in a
remap
transform only exist in that specificremap
transform (and are independent for every event being process). I think what you want to do is assign the result to a field, as you suggested. To avoid that field ending up on the event in Elasticsearch you can useencoding.drop_fields = ["elastic_index"]
. Hopefully this helps!