Search in sources :

Example 1 with LogsMessage

use of com.wavefront.agent.logsharvesting.LogsMessage in project java by wavefrontHQ.

the class RawLogsIngesterPortUnificationHandler method processLine.

@VisibleForTesting
@Override
public void processLine(final ChannelHandlerContext ctx, @Nonnull String message, @Nullable DataFormat format) {
    received.inc();
    ReportableEntityPreprocessor preprocessor = preprocessorSupplier == null ? null : preprocessorSupplier.get();
    String processedMessage = preprocessor == null ? message : preprocessor.forPointLine().transform(message);
    if (preprocessor != null && !preprocessor.forPointLine().filter(message, null))
        return;
    logsIngester.ingestLog(new LogsMessage() {

        @Override
        public String getLogLine() {
            return processedMessage;
        }

        @Override
        public String hostOrDefault(String fallbackHost) {
            String hostname = hostnameResolver.apply(getRemoteAddress(ctx));
            return StringUtils.isBlank(hostname) ? fallbackHost : hostname;
        }
    });
}
Also used : ReportableEntityPreprocessor(com.wavefront.agent.preprocessor.ReportableEntityPreprocessor) LogsMessage(com.wavefront.agent.logsharvesting.LogsMessage) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 LogsMessage (com.wavefront.agent.logsharvesting.LogsMessage)1 ReportableEntityPreprocessor (com.wavefront.agent.preprocessor.ReportableEntityPreprocessor)1