Search in sources :

Example 1 with VarFormatter

use of loghub.VarFormatter in project LogHub by fbacchella.

the class Merge method configure.

@Override
public boolean configure(Properties properties) {
    if (indexSource == null) {
        return false;
    }
    repository = new EventsRepository<String>(properties);
    cumulators = new ConcurrentHashMap<>(seeds.size() + 1);
    // Default to timestamp is to keep the first
    cumulators.put("@timestamp", Cumulator.FIRST.cumulate(null));
    for (Entry<String, Object> i : seeds.entrySet()) {
        cumulators.put(i.getKey(), Cumulator.getCumulator(i.getValue()));
    }
    index = new VarFormatter(indexSource);
    // Prepare fire only if test and processor given for that
    if (fireSource != null && fireProcessor != null) {
        try {
            fire = new Expression(fireSource, properties.groovyClassLoader, properties.formatters);
        } catch (ExpressionException e) {
            Expression.logError(e, fireSource, logger);
            return false;
        }
        if (!fireProcessor.configure(properties)) {
            return false;
        }
    }
    if (timeoutProcessor != null && !timeoutProcessor.configure(properties)) {
        return false;
    }
    if (nextPipeline == null) {
        return false;
    }
    return super.configure(properties);
}
Also used : VarFormatter(loghub.VarFormatter) Expression(loghub.Expression) ExpressionException(loghub.Expression.ExpressionException)

Aggregations

Expression (loghub.Expression)1 ExpressionException (loghub.Expression.ExpressionException)1 VarFormatter (loghub.VarFormatter)1