Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
subugoe
metsimporter
Commits
d7116145
Commit
d7116145
authored
Jan 13, 2022
by
Joerg-Holger Panzer
Browse files
Remove log hook
parent
a75921b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
collector/helper/api.go
View file @
d7116145
...
...
@@ -16,9 +16,7 @@ import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/go-redis/redis"
"github.com/olivere/elastic"
"github.com/sirupsen/logrus"
"gopkg.in/sohlich/elogrus.v3"
sub
"gitlab.gwdg.de/subugoe/shared-product-configs/sub"
...
...
@@ -116,21 +114,23 @@ func init() {
}
if
config
.
LogESURL
!=
""
&&
config
.
LogESIndex
!=
""
{
log
.
Infof
(
"Setting ES Logging index to %s on %s"
,
config
.
LogESIndex
,
config
.
LogESURL
)
client
,
err
:=
elastic
.
NewClient
(
elastic
.
SetURL
(
config
.
LogESURL
))
if
err
!=
nil
{
log
.
Panic
(
err
)
}
serviceName
:=
strings
.
Split
(
filepath
.
Base
(
config
.
LogFile
),
"."
)[
0
]
var
logLevel
logrus
.
Level
logLevel
,
_
=
logrus
.
ParseLevel
(
config
.
LogLevel
)
hook
,
err
:=
elogrus
.
NewAsyncElasticHook
(
client
,
serviceName
,
logLevel
,
config
.
LogESIndex
)
if
err
!=
nil
{
log
.
Panic
(
err
)
/*
if config.ElasticsearchHost != "" && config.LogESIndex != "" {
log.Infof("Setting ES Logging index to %s on %s", config.LogESIndex, config.ElasticsearchHost)
client, err := elastic.NewClient(elastic.SetURL(config.ElasticsearchHost))
if err != nil {
log.Panic(err)
}
serviceName := strings.Split(filepath.Base(config.LogFile), ".")[0]
var logLevel logrus.Level
logLevel, _ = logrus.ParseLevel(config.LogLevel)
hook, err := elogrus.NewAsyncElasticHook(client, serviceName, logLevel, config.LogESIndex)
if err != nil {
log.Panic(err)
}
log.Hooks.Add(hook)
}
log
.
Hooks
.
Add
(
hook
)
}
*/
}
inClient
=
getS3Client
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment