Skip to content

Commit

Permalink
Merge pull request #198 from Security-Onion-Solutions/kilo
Browse files Browse the repository at this point in the history
switch to JSON logger
  • Loading branch information
jertel authored Mar 21, 2023
2 parents 32879e7 + 307a594 commit 3f1e630
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ config.json
sensoroni.log
sensoroni
jobs/
logs/
nsm/
.vscode/
.DS_Store
Expand Down
4 changes: 2 additions & 2 deletions cmd/sensoroni.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"time"

"github.com/apex/log"
"github.com/apex/log/handlers/logfmt"
"github.com/apex/log/handlers/json"
"github.com/apex/log/handlers/text"
"github.com/security-onion-solutions/securityonion-soc/agent"
agentModules "github.com/security-onion-solutions/securityonion-soc/agent/modules"
Expand All @@ -34,7 +34,7 @@ var (
func InitLogging(logFilename string, logLevel string) (*os.File, error) {
logFile, err := os.OpenFile(logFilename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
if err == nil {
log.SetHandler(logfmt.New(logFile))
log.SetHandler(json.New(logFile))
} else {
log.WithError(err).WithField("logfile", logFilename).Error("Failed to create log file, using console instead")
log.SetHandler(text.New(os.Stdout))
Expand Down

0 comments on commit 3f1e630

Please sign in to comment.