Skip to content

Commit

Permalink
fix: add missing replace block (#388)
Browse files Browse the repository at this point in the history
* fix: add missing replace block

* fix: add missing replace block on collect template
  • Loading branch information
rkspx authored Mar 2, 2022
1 parent 95c1131 commit cc29a61
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions internal/pkg/dpluger/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,18 @@ filter {
{{ if .SIDListGroup }}{{ range $i, $g := .SIDListGroup }}
if [plugin_sid] in [{{ range $idx, $rev := $g.Plugins }}{{ if $idx }}, {{ end }}"{{ $rev.SID }}"{{ end }}] {
mutate { {{ if $g.CustomData.CustomLabel1 }}
"custom_label1" => "{{ $g.CustomData.CustomLabel1 }}"{{ end }}{{ if $g.CustomData.CustomData1 }}
"custom_data1" => "{{ transform $g.CustomData.CustomData1 "." }}"{{ end }}{{ if $g.CustomData.CustomLabel2 }}
"custom_label2" => "{{ $g.CustomData.CustomLabel2 }}"{{ end }}{{ if $g.CustomData.CustomData2 }}
"custom_data2" => "{{ transform $g.CustomData.CustomData2 "." }}"{{ end }}{{ if $g.CustomData.CustomLabel3 }}
"custom_label3" => "{{ $g.CustomData.CustomLabel3 }}"{{ end }}{{ if $g.CustomData.CustomData3 }}
"custom_data3" => "{{ transform $g.CustomData.CustomData3 "." }}"{{ end }}
mutate {
replace { {{ if $g.CustomData.CustomLabel1 }}
"custom_label1" => "{{ $g.CustomData.CustomLabel1 }}"{{ end }}{{ if $g.CustomData.CustomData1 }}
"custom_data1" => "{{ transform $g.CustomData.CustomData1 "." }}"{{ end }}{{ if $g.CustomData.CustomLabel2 }}
"custom_label2" => "{{ $g.CustomData.CustomLabel2 }}"{{ end }}{{ if $g.CustomData.CustomData2 }}
"custom_data2" => "{{ transform $g.CustomData.CustomData2 "." }}"{{ end }}{{ if $g.CustomData.CustomLabel3 }}
"custom_label3" => "{{ $g.CustomData.CustomLabel3 }}"{{ end }}{{ if $g.CustomData.CustomData3 }}
"custom_data3" => "{{ transform $g.CustomData.CustomData3 "." }}"{{ end }}
}
}
}{{ end }}{{ end }}
{{if .IsIntegerMutationRequired}}
mutate {
id => "integer fields {{.Plugin.Fields.PluginID}}"
Expand Down Expand Up @@ -259,13 +262,15 @@ filter {
{{ if .SIDListGroup }}{{ range $i, $g := .SIDListGroup }}
if [plugin_sid] in [{{ range $idx, $rev := $g.Plugins }}{{ if $idx }}, {{ end }}"{{ $rev.SID }}"{{ end }}] {
mutate { {{ if $g.CustomData.CustomLabel1 }}
"custom_label1" => "{{ $g.CustomData.CustomLabel1 }}"{{ end }}{{ if $g.CustomData.CustomData1 }}
"custom_data1" => "{{ transform $g.CustomData.CustomData1 "." }}"{{ end }}{{ if $g.CustomData.CustomLabel2 }}
"custom_label2" => "{{ $g.CustomData.CustomLabel2 }}"{{ end }}{{ if $g.CustomData.CustomData2 }}
"custom_data2" => "{{ transform $g.CustomData.CustomData2 "." }}"{{ end }}{{ if $g.CustomData.CustomLabel3 }}
"custom_label3" => "{{ $g.CustomData.CustomLabel3 }}"{{ end }}{{ if $g.CustomData.CustomData3 }}
"custom_data3" => "{{ transform $g.CustomData.CustomData3 "." }}"{{ end }}
mutate {
replace { {{ if $g.CustomData.CustomLabel1 }}
"custom_label1" => "{{ $g.CustomData.CustomLabel1 }}"{{ end }}{{ if $g.CustomData.CustomData1 }}
"custom_data1" => "{{ transform $g.CustomData.CustomData1 "." }}"{{ end }}{{ if $g.CustomData.CustomLabel2 }}
"custom_label2" => "{{ $g.CustomData.CustomLabel2 }}"{{ end }}{{ if $g.CustomData.CustomData2 }}
"custom_data2" => "{{ transform $g.CustomData.CustomData2 "." }}"{{ end }}{{ if $g.CustomData.CustomLabel3 }}
"custom_label3" => "{{ $g.CustomData.CustomLabel3 }}"{{ end }}{{ if $g.CustomData.CustomData3 }}
"custom_data3" => "{{ transform $g.CustomData.CustomData3 "." }}"{{ end }}
}
}
}{{ end }}{{ end }}
Expand Down

0 comments on commit cc29a61

Please sign in to comment.