My event stream log items look like this:
<timestamp>, <event_id>, <resource_id>, <resource_type>
My event_id fields can be several strings that look like this:
- FOO_BEGIN
- FOO_END
- BAR_BEGIN
- BAR_END
- BUZZ_BEGIN
- BUZZ_END
For any particular resource_id
, I have multiple BEGIN/END pairs for various workflow events on a resource.
Since the elapsed
plugin uses tags, not events, I also have a mutate
filter that adds the FOO_BEGIN/FOO_END, BAR_BEGIN/BAR_END event names as tags to those logged items. I'm planning to use these tag names in the elapsed
blocks and use the the literal string "resource_id" in the unique_id_field
like this:
elapsed {
start_tag => "FOO_BEGIN"
end_tag => "FOO_END"
unique_id_field => "resource_id"
timeout => 600
}
My questions:
- If I want to measure the elapsed time between several BEGIN/END pairs, do I have to create a separate
elapsed
logstash item for each? That is, do I need a separateelapsed
structure for each event pair: FOO, BAR, BUZZ? Or can I create a singleelapsed
block that has a variablestart_tag
andend_tag
value? Something like this maybe:
elapsed {
start_tag => "%{SOMEVARIABLE}_BEGIN"
end_tag => "%{SOMEVARIABLE}_END"
unique_id_field => "resource_id"
timeout => 600
}
- Is it ok that the
elapsed
blocks are outside anyif
block and executed even on events that are not the targets? Or do I need to put theseelapsed
blocks within anif
structure to isolate them just for those events?
Thanks for your help.