com.raynigon.ecs.logging.access.processor.SourceAddressProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ecs-logging-access Show documentation
Show all versions of ecs-logging-access Show documentation
The ecs-logging-access is a part of the unit-api
The newest version!
package com.raynigon.ecs.logging.access.processor;
import ch.qos.logback.access.common.spi.IAccessEvent;
import com.raynigon.ecs.logging.access.event.EcsAccessLogEvent;
public class SourceAddressProcessor implements AccessEventProcessor {
@Override
public EcsAccessLogEvent process(EcsAccessLogEvent result, IAccessEvent event) {
String xForwardForHeader = event.getRequestHeader("X-Forwarded-For");
String sourceAddress = xForwardForHeader != null ? xForwardForHeader : event.getRemoteAddr();
return result.toBuilder().clientAddress(sourceAddress).build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy