@Override
    protected Map<String, Object> toJsonMap(IAccessEvent event) {
        return new MapBuilder(timestampFormatter, customFieldNames, additionalFields, includes.size())
            .addNumber("port", isIncluded(AccessAttribute.LOCAL_PORT), event::getLocalPort)
            .addNumber("contentLength", isIncluded(AccessAttribute.CONTENT_LENGTH), event::getContentLength)
            .addTimestamp("timestamp", isIncluded(AccessAttribute.TIMESTAMP), event.getTimeStamp())
            .add("method", isIncluded(AccessAttribute.METHOD), event::getMethod)
            .add("protocol", isIncluded(AccessAttribute.PROTOCOL), event::getProtocol)
            .add("requestContent", isIncluded(AccessAttribute.REQUEST_CONTENT), event::getRequestContent)
            .add("remoteAddress", isIncluded(AccessAttribute.REMOTE_ADDRESS), event::getRemoteAddr)
            .add("remoteUser", isIncluded(AccessAttribute.REMOTE_USER), event::getRemoteUser)
            .addMap("headers", !requestHeaders.isEmpty(),
                () -> filterHeaders(event.getRequestHeaderMap(), requestHeaders))
            .addMap("params", isIncluded(AccessAttribute.REQUEST_PARAMETERS), event::getRequestParameterMap)
            .addNumber("requestTime", isIncluded(AccessAttribute.REQUEST_TIME), event::getElapsedTime)
            .add("uri", isIncluded(AccessAttribute.REQUEST_URI), event::getRequestURI)
            .add("url", isIncluded(AccessAttribute.REQUEST_URL), event::getRequestURL)
            .add("pathQuery", isIncluded(AccessAttribute.PATH_QUERY), () -> event.getRequestURI() + event.getQueryString())
            .add("remoteHost", isIncluded(AccessAttribute.REMOTE_HOST), event::getRemoteHost)
            .add("responseContent", isIncluded(AccessAttribute.RESPONSE_CONTENT), event::getResponseContent)
            .addMap("responseHeaders", !responseHeaders.isEmpty(),
                () -> filterHeaders(event.getResponseHeaderMap(), responseHeaders))
            .add("serverName", isIncluded(AccessAttribute.SERVER_NAME), event::getServerName)
            .addNumber("status", isIncluded(AccessAttribute.STATUS_CODE), event::getStatusCode)
            .add("userAgent", isIncluded(AccessAttribute.USER_AGENT), () -> event.getRequestHeader(USER_AGENT))
            .add("version", jsonProtocolVersion != null, jsonProtocolVersion)
            .addMap("requestAttributes", !requestAttributes.isEmpty(),
                () -> filterRequestAttributes(requestAttributes, event))
            .build();
    }
@Test
    void testCustomFieldNames() {
        final Map<String, String> customFieldNames = Map.of(
                "remoteUser", "remote_user",
                "userAgent", "user_agent",
                "remoteAddress", "remote_address",
                "contentLength", "content_length",
                "requestTime", "request_time");
        accessJsonLayout = new AccessJsonLayout(jsonFormatter, timestampFormatter, includes, customFieldNames, Collections.emptyMap());
        assertThat(accessJsonLayout.toJsonMap(event)).containsOnly(
            entry("timestamp", timestamp), entry("remote_user", "john"),
            entry("method", "GET"), entry("uri", uri),
            entry("protocol", "HTTP/1.1"), entry("status", 200),
            entry("request_time", 100L), entry("content_length", 78L),
            entry("user_agent", userAgent), entry("remote_address", remoteAddress));
    }