You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the following code I want to exclude data from index_name variable in output file but creating file requires index_name variable value as file name how can I do this ?
`sources:
swarm:
type: docker_logs
auto_partial_merge: true
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following code I want to exclude data from index_name variable in output file but creating file requires index_name variable value as file name how can I do this ?
`sources:
swarm:
type: docker_logs
auto_partial_merge: true
transforms:
filter_swarm:
type: filter
inputs:
- "swarm"
condition:
type: vrl
source: match(to_string!(.label."com.docker.stack.namespace"), r'^(dev-${PROJECT}|uat-${PROJECT}|prod-${PROJECT}|preprod-${PROJECT})')
remap_swarm:
type: remap
inputs:
- "filter_swarm"
source: |
.stack_namespace = .label."com.docker.stack.namespace"
if match(to_string!(.stack_namespace), r'^(dev-${PROJECT}|uat-${PROJECT}|prod-${PROJECT}|preprod-${PROJECT})') {
index = split!(.stack_namespace,"-")
project = slice!("${PROJECT}", start: 0, end: 3)
env = index[0]
.index_name = project+"-"+env
}
del(.label)
del(.stream)
del(.index_name)
sinks:
file:
inputs:
- "remap_swarm"
type: file
path: "/out/{{ .index_name }}"
encoding:
codec: "json"
`
Removing index_name in transform Result in error ERROR sink{component_kind="sink" component_id=file component_type=file}: vector::internal_events::template: Failed to render template for "path". error=Missing fields on event: [".index_name"] error_type="template_failed" stage="processing" internal_log_rate_limit=true
Beta Was this translation helpful? Give feedback.
All reactions