use of org.dcache.util.NetLoggerBuilder in project dcache by dCache.
the class AccessLogHandler method userEventTriggered.
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
if (evt instanceof LoginEvent) {
LoginReply loginReply = ((LoginEvent) evt).getLoginReply();
Subject subject = loginReply.getSubject();
NetLoggerBuilder log = new NetLoggerBuilder(INFO, "org.dcache.xrootd.login").omitNullValues();
log.add("session", CDC.getSession());
log.add("user.dn", Subjects.getDn(subject));
log.add("user.sub", Subjects.getPrincipalNames(subject, OidcSubjectPrincipal.class));
log.add("user.jti", Subjects.getPrincipalNames(subject, JwtJtiPrincipal.class));
log.add("user.mapped", subject);
log.toLogger(logger);
}
ctx.fireUserEventTriggered(evt);
}
use of org.dcache.util.NetLoggerBuilder in project dcache by dCache.
the class AccessLogHandler method channelInactive.
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
NetLoggerBuilder log = new NetLoggerBuilder(INFO, "org.dcache.xrootd.connection.end").omitNullValues();
log.add("session", CDC.getSession());
log.toLogger(logger);
ctx.fireChannelInactive();
}
use of org.dcache.util.NetLoggerBuilder in project dcache by dCache.
the class ProxyAccessLogHandler method channelRead.
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
if (msg instanceof HAProxyMessage) {
HAProxyMessage proxyMessage = (HAProxyMessage) msg;
if (proxyMessage.command() == HAProxyCommand.PROXY) {
InetSocketAddress remoteAddress = (InetSocketAddress) ctx.channel().remoteAddress();
InetSocketAddress localAddress = (InetSocketAddress) ctx.channel().localAddress();
String sourceAddress = proxyMessage.sourceAddress();
String destinationAddress = proxyMessage.destinationAddress();
if (proxyMessage.proxiedProtocol() == HAProxyProxiedProtocol.UNKNOWN) {
NetLoggerBuilder log = new NetLoggerBuilder(INFO, "org.dcache.xrootd.connection.start").omitNullValues();
log.add("session", CDC.getSession());
log.add("socket.remote", remoteAddress);
log.add("socket.local", localAddress);
log.toLogger(logger);
replaceWith(ctx, handler);
} else if (!Objects.equals(destinationAddress, localAddress.getAddress().getHostAddress())) {
/* The above check is a workaround for what looks like a bug in HAProxy - health checks
* should generate a LOCAL command, but it appears they do actually use PROXY.
*/
NetLoggerBuilder log = new NetLoggerBuilder(INFO, "org.dcache.xrootd.connection.start").omitNullValues();
log.add("session", CDC.getSession());
log.add("socket.remote", HostAndPort.fromParts(sourceAddress, proxyMessage.sourcePort()));
log.add("socket.proxy", HostAndPort.fromParts(destinationAddress, proxyMessage.destinationPort()));
log.add("socket.local", localAddress);
log.toLogger(logger);
replaceWith(ctx, handler);
}
}
}
super.channelRead(ctx, msg);
}
use of org.dcache.util.NetLoggerBuilder in project dcache by dCache.
the class HttpdRequestLog method log.
public void log(Request request, Response response) {
NetLoggerBuilder log = new NetLoggerBuilder(logLevel(response), "org.dcache.httpd.request");
log.add("request.method", request.getMethod());
log.add("request.scheme", request.getScheme());
log.add("request.url", request.getRequestURL());
log.add("request.hostname", request.getLocalName());
log.add("request.remoteIP", request.getRemoteAddr());
log.add("response.code", response.getStatus());
log.toLogger(ACCESS_LOGGER);
}
use of org.dcache.util.NetLoggerBuilder in project dcache by dCache.
the class EventLogger method sendEnd.
public static void sendEnd(CellMessage envelope) {
if (send.isInfoEnabled() && !envelope.isStreamMode()) {
NetLoggerBuilder log = new NetLoggerBuilder(SEND_END);
log.add("uoid", envelope.getUOID());
log.add("session", envelope.getSession());
send.info(log.toString());
}
}
Aggregations