@GetMapping(path = "/stream", produces = MediaType.APPLICATION_JSON_VALUE)
    @Operation(summary = "Fetch the last X number of log entries from all CAS appenders configured to capture logs",
        parameters = {
            @Parameter(name = "count", in = ParameterIn.QUERY, description = "The number of log entries to fetch", required = false),
            @Parameter(name = "level", in = ParameterIn.QUERY, description = "The log level to filter statements", required = false)
        })
    public List getLogEntries(@RequestParam(name = "count", required = false, defaultValue = "50") final int count,
                              @RequestParam(name = "level", required = false) final String level,
                              @RequestParam(name = "name", required = false) final String name) {
        initializeIfNecessary();
        val configuration = loggerContext.getConfiguration();
        return configuration.getAppenders()
            .values()
            .stream()
            .filter(CasAppender.class::isInstance)
            .map(CasAppender.class::cast)
            .filter(appender -> StringUtils.isBlank(name) || appender.getName().equalsIgnoreCase(name))
            .map(appender -> {
                val currentEvents = appender.getLogEvents()
                    .stream()
                    .filter(logEvent -> StringUtils.isBlank(level) || logEvent.getLevel().name().equalsIgnoreCase(level))
                    .map(logEvent -> {
                        val timestamp = DateTimeUtils.zonedDateTimeOf(logEvent.getInstant().getEpochMillisecond());
                        return new LogEvent(logEvent.getMessage().getFormattedMessage(), timestamp, logEvent.getLevel().name());
                    })
                    .toList();
                val start = Math.max(0, currentEvents.size() - count);
                return currentEvents.subList(start, currentEvents.size());
            })
            .filter(events -> !events.isEmpty())
            .flatMap(List::stream)
            .toList();
    }
Gets log entries.

@param count the count
@param level the level
@return the log entries
core/cas-server-core-logging/src/main/java/org/apereo/cas/logging/web/LoggingConfigurationEndpoint.java