Can apmzerolog send every log to link tracking?

I want to log the log of a specific log level in the application to the link tracking system, but I found that there is no good way, how can I solve it?

Thank you.

@axw can you help me, thank you.

I want to log the log of a specific log level in the application to the link tracking system

@EDDYCJY sorry, I don't understand what you mean by logging "to the link tracking system". Do you mean that you want to send your logs to Elastic APM?

Are you looking for something like apmlogrus package - go.elastic.co/apm/module/apmlogrus - Go Packages, but for apmzerolog instead? If so, can you provide some details on why the default behaviour of sending Error, Fatal, Panic level logs is not sufficient?

@axw yes, i want send my logs to Elastic APM.

I am looking for something like https://godoc.org/go.elastic.co/apm/module/apmlogrus#Hook.LogLevels, but apmzerolog doesn't seem to.

Just error logs though, right? Elastic APM is not designed for sending all logs, only errors/exceptions. In case you were plannign to send all of your logs, Filebeat is a more appropriate solution.

We could add a Level field to Writer, which would be the minimum log level to send. i.e. you could set Writer.Level = zerolog.FatalLevel, which would cause all FatalLevel and PanicLevel log records to be sent as errors to Elastic APM, while ErrorLevel messages would only go to the log file. Would that suit your requirements?

Yes, I think you can add a Level field, and the minimum log level user should be able to control it.

I've opened a feature request issue. I would appreciate it if you could have a read, and check the details:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.