use of org.graylog2.plugin.inputs.util.PacketInformationDumper in project graylog2-server by Graylog2.
the class NettyTransport method getBaseChannelHandlers.
/**
* Subclasses can override this to add additional ChannelHandlers to the pipeline to support additional features.
* <p/>
* Some common use cases are to add SSL/TLS, connection counters or throttling traffic shapers.
*
* @param input
* @return the list of initial channelhandlers to add to the {@link org.jboss.netty.channel.ChannelPipelineFactory}
*/
protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getBaseChannelHandlers(final MessageInput input) {
LinkedHashMap<String, Callable<? extends ChannelHandler>> handlerList = Maps.newLinkedHashMap();
handlerList.put("exception-logger", new Callable<ChannelHandler>() {
@Override
public ChannelHandler call() throws Exception {
return new SimpleChannelUpstreamHandler() {
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
if ("Connection reset by peer".equals(e.getCause().getMessage())) {
log.trace("{} in Input [{}/{}] (channel {})", e.getCause().getMessage(), input.getName(), input.getId(), e.getChannel());
} else {
log.error("Error in Input [{}/{}] (channel {})", input.getName(), input.getId(), e.getChannel(), e.getCause());
}
super.exceptionCaught(ctx, e);
}
};
}
});
handlerList.put("packet-meta-dumper", new Callable<ChannelHandler>() {
@Override
public ChannelHandler call() throws Exception {
return new PacketInformationDumper(input);
}
});
handlerList.put("traffic-counter", Callables.returning(throughputCounter));
return handlerList;
}
Aggregations