# Node Auth0 lib - Retrieving logs by checkpoint

**URL:** <https://community.auth0.com/t/node-auth0-lib-retrieving-logs-by-checkpoint/76747>\
**Category:** Product Feedback\
**Created:** [January 20, 2022, 5:44pm UTC](https://community.auth0.com/t/node-auth0-lib-retrieving-logs-by-checkpoint/76747 "2022-01-20T17:44:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ishoemaker](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ishoemaker/32/33845_2.png) [@ishoemaker](https://community.auth0.com/u/ishoemaker)\
**Post date:** [January 20, 2022, 5:44pm UTC](https://community.auth0.com/t/node-auth0-lib-retrieving-logs-by-checkpoint/76747/1 "2022-01-20T17:44:30Z")

</div>

I had a use case where I wanted to investigate various logs and their types; mostly to group and count error instances. I see there is both pagination and checkpoint styles in retrieving logs - [https://auth0.com/docs/deploy-monitor/logs/retrieve-log-events-using-mgmt-ap](https://auth0.com/docs/deploy-monitor/logs/retrieve-log-events-using-mgmt-ap).

With pagination, you’re only able to retrieve up to a certain number of pages of results which is fine. When you’re looking to get a larger set, it looks like we should retrieve by checkpoint. As I understand it, you use checkpoint mode by giving `from` and `take` params as referenced in the above link.

I attempted both of these styles with the node auth0 lib’s `getLogs` method - [https://auth0.github.io/node-auth0/module-management.ManagementClient.html#getLogs](https://auth0.github.io/node-auth0/module-management.ManagementClient.html#getLogs)

First, the docs don’t actually mention `from` and `take` but they are supported. This is just a minor feedback item. The more pressing issue I have is that when working with the checkpoint style, the result is only the body contents which is an array of logs for the given checkpoint instance. As I read the docs, the client is expected to receive a `Link` http header which would give the url for the next checkpoint of results.

Unfortunately, the node lib doesn’t expose this to the consumer and so I can’t retrieve the next set of logs. My expectation would have been the result of a call to `getLogs({from: "my_first_log_id", take:100})` would be a wrapper object with some metadata including this `Link` header along with the result body. The client would then be expected to make a subsequent call to something like `getLogCheckpoint(link)`.

Alternatively, there could be a convenience method for `getAllCheckpointLogs` where the auth0 lib implements the fetches and returns a full in memory array (for better or for worse.)

I also understand there is a logStream capability, but for the moment I am doing this more for off hand investigations rather than wanting to hook this up to a full blown log aggregation service.

---

<div class="post-metadata">

**Author:** ![sgreene](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sgreene/32/33848_2.png) [@sgreene](https://community.auth0.com/u/sgreene)\
**Post date:** [January 20, 2022, 6:48pm UTC](https://community.auth0.com/t/node-auth0-lib-retrieving-logs-by-checkpoint/76747/2 "2022-01-20T18:48:57Z")

</div>

I’ve had this same exact issue.

---

<div class="post-metadata">

**Author:** ![ishoemaker](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ishoemaker/32/33845_2.png) [@ishoemaker](https://community.auth0.com/u/ishoemaker)\
**Post date:** [February 3, 2022, 3:57pm UTC](https://community.auth0.com/t/node-auth0-lib-retrieving-logs-by-checkpoint/76747/3 "2022-02-03T15:57:44Z")

</div>

Any thoughts on this?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [February 3, 2022, 4:30pm UTC](https://community.auth0.com/t/node-auth0-lib-retrieving-logs-by-checkpoint/76747/4 "2022-02-03T16:30:09Z")

</div>

Hi @ishoemaker,

Thanks for this thorough feedback! I will pass this along to the team that manages the node-auth0 SDK.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [March 2, 2022, 6:18pm UTC](https://community.auth0.com/t/node-auth0-lib-retrieving-logs-by-checkpoint/76747/5 "2022-03-02T18:18:35Z")

</div>

Hi @ishoemaker,

Here is the response from the team:

* * *

> [@ishoemaker](#):
>
> First, the docs don’t actually mention `from` and `take` but they are supported.

_I see `from` and `take` arguments documented in the `getAll` method of the `LogsManager`_

 ![image](https://global.discourse-cdn.com/auth0/original/3X/e/4/e49a77579da0a771175225aa3ce8b2214e52cb63.jpeg)

> [@ishoemaker](#):
>
> The more pressing issue I have is that when working with the checkpoint style, the result is only the body contents which is an array of logs for the given checkpoint instance

_This is expected, you use the `log_id` of your last result as the cursor for your next request._

* * *

Does that clarify things? Let me know!

---

<div class="post-metadata">

**Author:** ![ishoemaker](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ishoemaker/32/33845_2.png) [@ishoemaker](https://community.auth0.com/u/ishoemaker)\
**Post date:** [March 2, 2022, 7:25pm UTC](https://community.auth0.com/t/node-auth0-lib-retrieving-logs-by-checkpoint/76747/6 "2022-03-02T19:25:49Z")

</div>

Hey @dan.woda

Interesting I wasn’t looking at the LogManager but instead the `getLogs` method on the ManagementClient object. I see my original post’s links aren’t resolving correctly and I’m not sure if I just botched that or if it got moved.

What I had been looking at was this [ManagementClient - Documentation](https://auth0.github.io/node-auth0/ManagementClient.html#getLogs) and it did take the `from` and `take` params but it wasn’t clear how it was meant to be utilized.

It does look like the LogsManager can work for what we’re looking to do and I’ll give that a shot when I can, but that wasn’t apparent to me because I believe I was referencing some guides from Auth0 that linked directly into the “ManagementClient” view’s log methods and there was no reference to a LogsManager.

I appreciate following up on this!

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [March 2, 2022, 8:17pm UTC](https://community.auth0.com/t/node-auth0-lib-retrieving-logs-by-checkpoint/76747/7 "2022-03-02T20:17:14Z")

</div>

No problem! Let me know if this doesn’t solve for it and we can go from there.

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 17, 2022, 8:17pm UTC](https://community.auth0.com/t/node-auth0-lib-retrieving-logs-by-checkpoint/76747/8 "2022-03-17T20:17:15Z")

</div>

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