# Can apmzerolog send every log to link tracking?

**URL:** <https://discuss.elastic.co/t/can-apmzerolog-send-every-log-to-link-tracking/199802>\
**Category:** APM\
**Tags:** go\
**Created:** [September 17, 2019, 10:24am UTC](https://discuss.elastic.co/t/can-apmzerolog-send-every-log-to-link-tracking/199802 "2019-09-17T10:24:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![EDDYCJY](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eddycjy/32/54324_2.png) [@EDDYCJY](https://discuss.elastic.co/u/EDDYCJY)\
**Post date:** [September 17, 2019, 10:24am UTC](https://discuss.elastic.co/t/can-apmzerolog-send-every-log-to-link-tracking/199802/1 "2019-09-17T10:24:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![EDDYCJY](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eddycjy/32/54324_2.png) [@EDDYCJY](https://discuss.elastic.co/u/EDDYCJY)\
**Post date:** [September 17, 2019, 10:26am UTC](https://discuss.elastic.co/t/can-apmzerolog-send-every-log-to-link-tracking/199802/2 "2019-09-17T10:26:31Z")

</div>

@axw can you help me, thank you.

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [September 18, 2019, 1:58am UTC](https://discuss.elastic.co/t/can-apmzerolog-send-every-log-to-link-tracking/199802/3 "2019-09-18T01:58:39Z")

</div>

> 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](https://godoc.org/go.elastic.co/apm/module/apmlogrus#Hook.LogLevels), 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?

---

<div class="post-metadata">

**Author:** ![EDDYCJY](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eddycjy/32/54324_2.png) [@EDDYCJY](https://discuss.elastic.co/u/EDDYCJY)\
**Post date:** [September 18, 2019, 2:07am UTC](https://discuss.elastic.co/t/can-apmzerolog-send-every-log-to-link-tracking/199802/4 "2019-09-18T02:07:24Z")

</div>

@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](https://godoc.org/go.elastic.co/apm/module/apmlogrus#Hook.LogLevels), but apmzerolog doesn't seem to.

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [September 18, 2019, 2:30am UTC](https://discuss.elastic.co/t/can-apmzerolog-send-every-log-to-link-tracking/199802/5 "2019-09-18T02:30:57Z")

</div>

> [@EDDYCJY](#):
>
> @axw yes, i want send my logs to Elastic APM.

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?

---

<div class="post-metadata">

**Author:** ![EDDYCJY](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eddycjy/32/54324_2.png) [@EDDYCJY](https://discuss.elastic.co/u/EDDYCJY)\
**Post date:** [September 18, 2019, 7:49am UTC](https://discuss.elastic.co/t/can-apmzerolog-send-every-log-to-link-tracking/199802/7 "2019-09-18T07:49:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [September 18, 2019, 8:07am UTC](https://discuss.elastic.co/t/can-apmzerolog-send-every-log-to-link-tracking/199802/8 "2019-09-18T08:07:09Z")

</div>

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

> <https://github.com/elastic/apm-agent-go/issues/636>

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 9, 2019, 4:07am UTC](https://discuss.elastic.co/t/can-apmzerolog-send-every-log-to-link-tracking/199802/9 "2019-10-09T04:07:17Z")

</div>

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