Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update makefile deps #709

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ BINARY_NAME := go-dnscollector
GO_VERSION := $(shell go env GOVERSION | sed -n 's/go\([0-9]\+\.[0-9]\+\).*/\1/p')

GO_LOGGER := 0.4.0
GO_POWERDNS_PROTOBUF := 1.1.0
GO_DNSTAP_PROTOBUF := 1.0.0
GO_POWERDNS_PROTOBUF := 1.1.1
GO_DNSTAP_PROTOBUF := 1.0.1
GO_FRAMESTREAM := 0.10.0
GO_CLIENTSYSLOG := 0.3.0
GO_CLIENTSYSLOG := 0.4.0
GO_TOPMAP := 1.0.0

BUILD_TIME := $(shell LANG=en_US date +"%F_%T_%z")
Expand Down
41 changes: 2 additions & 39 deletions workers/syslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"crypto/tls"
"encoding/json"
"fmt"
"time"

"strings"
Expand All @@ -19,42 +18,6 @@ import (
"github.com/dmachard/go-logger"
)

func GetPriority(facility string) (syslog.Priority, error) {
facility = strings.ToUpper(facility)
switch facility {
// level
case "WARNING":
return syslog.LOG_WARNING, nil
case "NOTICE":
return syslog.LOG_NOTICE, nil
case "INFO":
return syslog.LOG_INFO, nil
case "DEBUG":
return syslog.LOG_DEBUG, nil
// facility
case "DAEMON":
return syslog.LOG_DAEMON, nil
case "LOCAL0":
return syslog.LOG_LOCAL0, nil
case "LOCAL1":
return syslog.LOG_LOCAL1, nil
case "LOCAL2":
return syslog.LOG_LOCAL2, nil
case "LOCAL3":
return syslog.LOG_LOCAL3, nil
case "LOCAL4":
return syslog.LOG_LOCAL4, nil
case "LOCAL5":
return syslog.LOG_LOCAL5, nil
case "LOCAL6":
return syslog.LOG_LOCAL6, nil
case "LOCAL7":
return syslog.LOG_LOCAL7, nil
default:
return 0, fmt.Errorf("invalid syslog priority: %s", facility)
}
}

type Syslog struct {
*pkgutils.GenericWorker
severity, facility syslog.Priority
Expand All @@ -80,13 +43,13 @@ func (w *Syslog) ReadConfig() {
if !pkgconfig.IsValidMode(w.GetConfig().Loggers.Syslog.Mode) {
w.LogFatal(pkgutils.PrefixLogWorker + "invalid mode text or json expected")
}
severity, err := GetPriority(w.GetConfig().Loggers.Syslog.Severity)
severity, err := syslog.GetPriority(w.GetConfig().Loggers.Syslog.Severity)
if err != nil {
w.LogFatal(pkgutils.PrefixLogWorker + "invalid severity")
}
w.severity = severity

facility, err := GetPriority(w.GetConfig().Loggers.Syslog.Facility)
facility, err := syslog.GetPriority(w.GetConfig().Loggers.Syslog.Facility)
if err != nil {
w.LogFatal(pkgutils.PrefixLogWorker + "invalid facility")
}
Expand Down
Loading