getNetworkEvents on switch to pull only the last 24 hours of logs

Del_B
Conversationalist

getNetworkEvents on switch to pull only the last 24 hours of logs

I have small sites with a single 8 port switch to large sites with up to 15 switches of various sizes.   Is there a way to pull just the last 24 hours of events from each switch on a site?
Seems like the "total_page" and "perPage" overrule the "endingBefore" or "startingAfter" options.

 

If I set "total_page" and "perPage" both to 10, I get 100 returns regardless of the "endingBefore" or "startingAfter" options.

If I use "endingBefore" or "startingAfter" options and leave out the "total_page" and "perPage" options, I get up to the default 30 returns.
You can not use "endingBefore" and "startingAfter" options together.  If you could that would be great.


Also, I have "excludedEventTypes=[ "port_status"] to reduce the events returned.   

2 Replies 2
PhilipDAth
Kind of a big deal
Kind of a big deal

This is the API documentation:
https://developer.cisco.com/meraki/api-v1/get-network-events/

 

startingAfter and endingBefore are used for pagination.  They are not for filtering the time range.

 

I don't see an option for extracting based on a time filter, so you'll need to request all the events and then filter by occurredAt as you receive them.

sungod
Head in the Cloud

I think the endpoint returns most recent events first.

 

So a workaround could be to check each page of returned events and stop getting the next page once there are events older than required.

Get notified when there are additional replies to this discussion.