# How to stream logs to Elastic APM with elastic-apm-node？

**URL:** <https://discuss.elastic.co/t/how-to-stream-logs-to-elastic-apm-with-elastic-apm-node/360139>\
**Category:** Elastic Observability\
**Tags:** elastic-stack-monitoring\
**Created:** [May 24, 2024, 8:20am UTC](https://discuss.elastic.co/t/how-to-stream-logs-to-elastic-apm-with-elastic-apm-node/360139 "2024-05-24T08:20:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chen\_Jiang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chen_jiang/32/125037_2.png) [@Chen\_Jiang](https://discuss.elastic.co/u/Chen_Jiang)\
**Post date:** [May 24, 2024, 8:20am UTC](https://discuss.elastic.co/t/how-to-stream-logs-to-elastic-apm-with-elastic-apm-node/360139/1 "2024-05-24T08:20:22Z")

</div>

I'm running a nestjs application, and already have a custom logger.  
I wanna correlate the log. How should I do？  
I searched docs, could not find sample code or api doc.

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [May 24, 2024, 10:53am UTC](https://discuss.elastic.co/t/how-to-stream-logs-to-elastic-apm-with-elastic-apm-node/360139/2 "2024-05-24T10:53:34Z")

</div>

Hi @Chen_Jiang,

the log correlation is performed using certain id fields. [This log correlation documentation](https://www.elastic.co/guide/en/apm/agent/nodejs/current/logs.html) should explain it. Let us know if that helps.

---

<div class="post-metadata">

**Author:** ![Chen\_Jiang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chen_jiang/32/125037_2.png) [@Chen\_Jiang](https://discuss.elastic.co/u/Chen_Jiang)\
**Post date:** [May 26, 2024, 12:59am UTC](https://discuss.elastic.co/t/how-to-stream-logs-to-elastic-apm-with-elastic-apm-node/360139/4 "2024-05-26T00:59:24Z")

</div>

Thank you for your response. I will try that. but I got a more urgent issue, [posted here](https://discuss.elastic.co/t/how-to-aggregate-trace-samples-by-specific-span/360142)  
could you give me some advice on that?
