@GetMapping(produces = {
        MediaType.APPLICATION_JSON_VALUE,
        MEDIA_TYPE_SPRING_BOOT_V2_JSON,
        MEDIA_TYPE_SPRING_BOOT_V3_JSON,
        MediaType.APPLICATION_FORM_URLENCODED_VALUE,
        MEDIA_TYPE_CAS_YAML
    })
    @Operation(summary = "Provide a report of CAS events in the event repository",
        parameters = @Parameter(name = "limit", required = false, description = "Limit the number of events to fetch"))
    public ResponseEntity events(
        @RequestParam(required = false, defaultValue = "1000")
        final int limit) throws Exception {
        val results = eventRepository.getObject().load()
            .sorted(Comparator.comparingLong(CasEvent::getTimestamp).reversed())
            .limit(limit)
            .collect(Collectors.toList());
        return ResponseEntity.ok(MAPPER.writeValueAsString(results));
    }
Collect CAS events.

@return the collection
core/cas-server-core-events-api/src/main/java/org/apereo/cas/support/events/web/CasEventsReportEndpoint.java