From 885cab5a2e5d7a2462490ed76b0f859081654927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Tue, 26 Sep 2023 10:33:00 +0200 Subject: [PATCH] conf: make host and appname configurable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: László Várady --- conf/configuration.go | 2 ++ formats/syslog/syslog.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/conf/configuration.go b/conf/configuration.go index 6723850..c6b58df 100644 --- a/conf/configuration.go +++ b/conf/configuration.go @@ -45,6 +45,8 @@ func Init() { viper.SetDefault("message.byte-per-sec", 200) viper.SetDefault("message.max-random-hosts", 1000) viper.SetDefault("message.max-random-apps", 100) + viper.SetDefault("message.host", "hostname") + viper.SetDefault("message.appname", "appname") viper.SetDefault("api.addr", ":11000") viper.SetDefault("api.basePath", "/") diff --git a/formats/syslog/syslog.go b/formats/syslog/syslog.go index 7405764..48c0553 100644 --- a/formats/syslog/syslog.go +++ b/formats/syslog/syslog.go @@ -64,8 +64,8 @@ func SampleData() TemplateData { Facility: 20, severity: 5, dateTime: time.Date(2011, 6, 25, 20, 0, 4, 0, time.UTC), - Host: "hostname", - AppName: "appname", + Host: viper.GetString("message.host"), + AppName: viper.GetString("message.appname"), PID: 1143, Seq: 1, Msg: "An application event log entry...",