-
QuestionHello everyone, I try to reconstruct a longer message splited in several chunks (all chunks have an unique chunk_id, and all chunks of the same message share a message_id to use in group_by). Also, all chunks include a total_chunk variable. in the merge_strategies, I place the variable chunk_id in array, so I can manage the possible out-of-order chunks in a later remap transform. I also try to add a .chunk_count = 1 variable and sum it in the reduce, the .chunk_count variable in the ends_when is not updated either. How can I access the value of these "reduced" variables in the ends_when statement ? Vector Configreduce_chunks:
type: reduce
inputs:
- udp_source
group_by:
- "message_id" # all chunks with the message_id (UUID) are part of the same original message
merge_strategies:
chunk: "array" # We place all chunk in a array
chunk_id: "array" # We place all chunk_id in a array to be able to reorder in a later remap transform
total_chunks: "discard" # We keep the first one (because all value are
ends_when:
type: vrl
source: |
log("Start Verifying last message", level: "info", rate_limit_secs: 0)
log(.chunk_id, level: "info", rate_limit_secs: 0) # We can see in the logs that .chunk_id is still an int and not an array
if is_array(.chunk_id) {
if exists(.total_chunks) {
log("array chunk_id is present and so is .total_chunks", level: "info", rate_limit_secs: 0)
if length(array!(.chunk_id)) >= to_int!(.total_chunks) {
log("this is last message", level: "info", rate_limit_secs: 0)
true
} else {
log("message is not the last", level: "info", rate_limit_secs: 0)
false
}
} else {
log(".total_chunks is missing", level: "info", rate_limit_secs: 0)
false
}
} else {
log("no array of .chunk_id", level: "info", rate_limit_secs: 0)
false
}Vector Logs2026-07-06T18:22:16.865912Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: Start Verifying last message internal_log_rate_secs=0 vrl_position=0
2026-07-06T18:22:16.865921Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: 0 internal_log_rate_secs=0 vrl_position=82
2026-07-06T18:22:16.865928Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: no array of .chunk_id internal_log_rate_secs=0 vrl_position=657
2026-07-06T18:22:16.865966Z TRACE transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vector_common::internal_event::events_received: Internal log [Events received.] is being suppressed to avoid flooding.
2026-07-06T18:22:16.865975Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: Start Verifying last message internal_log_rate_secs=0 vrl_position=0
2026-07-06T18:22:16.865981Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: 1 internal_log_rate_secs=0 vrl_position=82
2026-07-06T18:22:16.865987Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: no array of .chunk_id internal_log_rate_secs=0 vrl_position=657
2026-07-06T18:22:16.866213Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: Start Verifying last message internal_log_rate_secs=0 vrl_position=0
2026-07-06T18:22:16.866226Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: 2 internal_log_rate_secs=0 vrl_position=82
2026-07-06T18:22:16.866295Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: no array of .chunk_id internal_log_rate_secs=0 vrl_position=657
2026-07-06T18:22:16.866360Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: Start Verifying last message internal_log_rate_secs=0 vrl_position=0
2026-07-06T18:22:16.866390Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: 3 internal_log_rate_secs=0 vrl_position=82
2026-07-06T18:22:16.866406Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: no array of .chunk_id internal_log_rate_secs=0 vrl_position=657
2026-07-06T18:22:16.866445Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: Start Verifying last message internal_log_rate_secs=0 vrl_position=0
2026-07-06T18:22:16.866494Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: 4 internal_log_rate_secs=0 vrl_position=82
2026-07-06T18:22:16.866516Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: no array of .chunk_id internal_log_rate_secs=0 vrl_position=657
2026-07-06T18:22:16.866589Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: Start Verifying last message internal_log_rate_secs=0 vrl_position=0
2026-07-06T18:22:16.866636Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: 5 internal_log_rate_secs=0 vrl_position=82
2026-07-06T18:22:16.866665Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: no array of .chunk_id internal_log_rate_secs=0 vrl_position=657
2026-07-06T18:22:16.866778Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: Start Verifying last message internal_log_rate_secs=0 vrl_position=0
2026-07-06T18:22:16.866799Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: 6 internal_log_rate_secs=0 vrl_position=82
2026-07-06T18:22:16.866814Z INFO transform{component_kind="transform" component_id=reduce_chunks component_type=reduce}: vrl::stdlib::log::implementation: no array of .chunk_id internal_log_rate_secs=0 vrl_position=657
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
The reason So counting up to
The merged array only exists on the flushed output event, not during the |
Beta Was this translation helpful? Give feedback.
-
|
Answer : not possible as of 2026-07-08 |
Beta Was this translation helpful? Give feedback.
Answer : not possible as of 2026-07-08