private Optional<String> getIpFromXForwardedFor(final HttpServletRequest request) {
        final String forwardedFor = request.getHeader(X_FORWARDED_FOR);
        if (forwardedFor != null && !forwardedFor.isBlank()) {
            final String ip;
            // X_FORWARD_FOR may contain multiple IPs if it has been through multiple proxies
            // for example '1.2.3.4, 9.8.7.6'.  We will take the left most (i.e. most distant) one.
            if (forwardedFor.contains(",")) {
                ip = forwardedFor.substring(0, forwardedFor.indexOf(","));
            } else {
                ip = forwardedFor;
            }
            LOGGER.debug("{}: [{}], ip: [{}]", X_FORWARDED_FOR, forwardedFor, ip);
            return Optional.of(ip);
        } else {
            LOGGER.debug("{} is empty", X_FORWARDED_FOR);
            return Optional.empty();
        }
    }
Shallow merge of the two Purpose objects
stroom-event-logging/stroom-event-logging-impl/src/main/java/stroom/event/logging/impl/StroomEventLoggingServiceImpl.java