fix a confusing debug message (#2386)
* fix a confusing debug message * make CTIHelper simply log the error to avoid failing template rendering
This commit is contained in:
parent
5cb7013575
commit
718721b341
2 changed files with 10 additions and 3 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/crowdsecurity/crowdsec/pkg/exprhelpers"
|
||||
"github.com/crowdsecurity/crowdsec/pkg/models"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var helpers = template.FuncMap{
|
||||
|
@ -20,8 +21,14 @@ var helpers = template.FuncMap{
|
|||
}
|
||||
return metaValues
|
||||
},
|
||||
"CrowdsecCTI": exprhelpers.CrowdsecCTI,
|
||||
"Hostname": os.Hostname,
|
||||
"CrowdsecCTI": func(x string) any {
|
||||
ret, err := exprhelpers.CrowdsecCTI(x)
|
||||
if err != nil {
|
||||
log.Warningf("error while calling CrowdsecCTI : %s", err)
|
||||
}
|
||||
return ret
|
||||
},
|
||||
"Hostname": os.Hostname,
|
||||
}
|
||||
|
||||
func funcMap() template.FuncMap {
|
||||
|
|
|
@ -168,7 +168,7 @@ func (Profile *Runtime) EvaluateProfile(Alert *models.Alert) ([]*models.Decision
|
|||
for eIdx, expression := range Profile.RuntimeFilters {
|
||||
output, err := expr.Run(expression, map[string]interface{}{"Alert": Alert})
|
||||
if err != nil {
|
||||
Profile.Logger.Warningf("failed to run whitelist expr : %v", err)
|
||||
Profile.Logger.Warningf("failed to run profile expr for %s : %v", Profile.Cfg.Name, err)
|
||||
return nil, matched, errors.Wrapf(err, "while running expression %s", Profile.Cfg.Filters[eIdx])
|
||||
}
|
||||
switch out := output.(type) {
|
||||
|
|
Loading…
Reference in a new issue