Consul: When are events removed from the event list?

The documentation consul says: This endpoint returns the most recent events known to the agent.

What does this mean recently? Most 100 recent events? 1000? Events triggered in the last 7 days?

Is there any way to configure this?

My problem is that this list of events can grow infinitely if old events are not deleted within a reasonable amount of time (which may vary in different applications).

+5
source share
1 answer

So, after some digging into the source code of the consul. I found out that this is max 256

https://github.com/hashicorp/consul/blob/94835a2715892f48ffa9f81a9a32808d544b1ca5/agent/agent.go#L221

 eventBuf: make([]*UserEvent, 256), 

Below you can see the turn

https://github.com/hashicorp/consul/blob/94835a2715892f48ffa9f81a9a32808d544b1ca5/agent/user_event.go#L229

 a.eventBuf[idx] = msg a.eventIndex = (idx + 1) % len(a.eventBuf) 

The code below shows that the data is retrieved only from the same buffer.

https://github.com/hashicorp/consul/blob/94835a2715892f48ffa9f81a9a32808d544b1ca5/agent/user_event.go#L235

 func (a *Agent) UserEvents() []*UserEvent { 

So, you can safely assume that it will be max 256

+2
source

Source: https://habr.com/ru/post/1276023/


All Articles