mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-17 15:01:20 +02:00
25 lines
457 B
Go
25 lines
457 B
Go
package csplugin
|
|
|
|
import (
|
|
"text/template"
|
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/models"
|
|
)
|
|
|
|
var helpers = template.FuncMap{
|
|
"GetMeta": func(a *models.Alert, metaName string) []string {
|
|
var metaValues []string
|
|
for _, evt := range a.Events {
|
|
for _, meta := range evt.Meta {
|
|
if meta.Key == metaName {
|
|
metaValues = append(metaValues, meta.Value)
|
|
}
|
|
}
|
|
}
|
|
return metaValues
|
|
},
|
|
}
|
|
|
|
func funcMap() template.FuncMap {
|
|
return helpers
|
|
}
|