Logging Errors entries to Stackdriver Logging
lucastex opened this issue · comments
Hi guys, how are you doing? Does anyone experienced errors while sending log entries (ERROR LEVEL) to Logentries?
Here we did the basic, got the log and the hook working but we can't see ERROR level entries.
We log this
log.Info("Consumer LOG Info")
log.Warn("Consumer LOG Warn")
log.Warning("Consumer LOG Warning")
log.Error("Consumer LOG Error")
In the console we have
INFO[2019-03-29T18:33:44-03:00] Consumer LOG Info
WARN[2019-03-29T18:33:44-03:00] Consumer LOG Warn
WARN[2019-03-29T18:33:44-03:00] Consumer LOG Warning
ERRO[2019-03-29T18:33:44-03:00] Consumer LOG Error
But in the Stackdriver logs all we see is:
2019-03-29 18:33:44.000 BRT Consumer LOG Info
2019-03-29 18:33:44.000 BRT Consumer LOG Warn
2019-03-29 18:33:44.000 BRT Consumer LOG Warning
We have even tried to set all log levels in logger config doing this
stackdriverHook, err := sdhook.New(
sdhook.GoogleServiceAccountCredentialsFile(logStackdriverCredentialsFile),
sdhook.LogName(logAppName),
sdhook.Resource(sdhook.ResTypeGlobal, globalLabels),
sdhook.Levels(logrus.PanicLevel, logrus.FatalLevel, logrus.ErrorLevel, logrus.WarnLevel, logrus.InfoLevel),
)
:( Can anyone help us?
Thank you,
Lucas
Ok guys, sorry for this issue, just found in the docs what was happening. The entries are being sent to another error logname :) Sorry.
Hi guys, my bad on reopening this issue, but we're kind of confused here with the hook configuration. In the docs it is saying that "if you enable error reporing" error logs will be sent to the "_error" log, but we haven't enabled the error reporting, we're using just the stackdriver logging and the error entries are being sent to the same way "_error".
As we don't want to make logs in two different places, we've found the option ErrorReportingLogName
that looking into the source code would override this config, and we've defined ErrorReportingLogName
to the same value as the config LogName
, but when doing this, the error logs won't show in the logs viewer interface.
Is there any option to use just logs (no error reporting), and keep all entries (including errors) centralized in only one "logname" set?
Thanks,
Hi guys! Any news on this? Any clues on how to configure this on this use case?
Thanks,
Hey guys. Is anyone still working on this repo?
:)
@lucastex this is used in production, yes. It is merely a glue layer between Google's API and logrus. All of the error levels get passed through normally.