Skip to content

Commit e5b7f00

Browse files
authoredJul 1, 2021
Merge pull request crowdsecurity#16 from sbs2001/main
Improve logging levels. Imporve config handling in rpm build
2 parents 3595a61 + 20a7e59 commit e5b7f00

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
 

‎custom.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ func (c *customBouncer) Add(decision *models.Decision) error {
5252
if err != nil {
5353
return err
5454
}
55-
log.Printf("custom [%s] : add ban on %s for %s sec (%s)", c.path, *decision.Value, strconv.Itoa(int(banDuration.Seconds())), *decision.Scenario)
55+
log.Debugf("custom [%s] : add ban on %s for %s sec (%s)", c.path, *decision.Value, strconv.Itoa(int(banDuration.Seconds())), *decision.Scenario)
5656
str, err := serializeDecision(decision)
5757
if err != nil {
5858
log.Warningf("serialize: %s", err)
5959
}
6060
cmd := exec.Command(c.path, "add", *decision.Value, strconv.Itoa(int(banDuration.Seconds())), *decision.Scenario, str)
6161
if out, err := cmd.CombinedOutput(); err != nil {
62-
log.Infof("Error in 'add' command (%s): %v --> %s", cmd.String(), err, string(out))
62+
log.Errorf("Error in 'add' command (%s): %v --> %s", cmd.String(), err, string(out))
6363
}
6464
c.newDecisionValueSet[decisionToDecisionKey(decision)] = struct{}{}
6565
return nil
@@ -77,10 +77,10 @@ func (c *customBouncer) Delete(decision *models.Decision) error {
7777
if err != nil {
7878
log.Warningf("serialize: %s", err)
7979
}
80-
log.Printf("custom [%s] : del ban on %s for %s sec (%s)", c.path, *decision.Value, strconv.Itoa(int(banDuration.Seconds())), *decision.Scenario)
80+
log.Debugf("custom [%s] : del ban on %s for %s sec (%s)", c.path, *decision.Value, strconv.Itoa(int(banDuration.Seconds())), *decision.Scenario)
8181
cmd := exec.Command(c.path, "del", *decision.Value, strconv.Itoa(int(banDuration.Seconds())), *decision.Scenario, str)
8282
if out, err := cmd.CombinedOutput(); err != nil {
83-
log.Infof("Error in 'del' command (%s): %v --> %s", cmd.String(), err, string(out))
83+
log.Errorf("Error in 'del' command (%s): %v --> %s", cmd.String(), err, string(out))
8484
}
8585
c.expiredDecisionValueSet[decisionToDecisionKey(decision)] = struct{}{}
8686
return nil

‎rpm/SPECS/crowdsec-custom-bouncer.spec

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ rm -rf %{buildroot}
4747
%defattr(-,root,root,-)
4848
/usr/bin/%{name}
4949
%{_unitdir}/%{name}.service
50-
%config /etc/crowdsec/%{name}/%{name}.yaml
50+
%config(noreplace) /etc/crowdsec/%{name}/%{name}.yaml
5151

5252

5353
%post

0 commit comments

Comments
 (0)
Please sign in to comment.