Node Auth0 lib - Retrieving logs by checkpoint

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.

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

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.

I’ve had this same exact issue.

Any thoughts on this?

1 Like

Hi @ishoemaker,

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

1 Like

Hi @ishoemaker,

Here is the response from the team:


I see from and take arguments documented in the getAll method of the LogsManager

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!

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 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!

1 Like

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

Thanks!

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