use of org.graylog.events.fields.providers.FieldValueProvider in project graylog2-server by Graylog2.
the class EventFieldSpecEngine method execute.
public void execute(List<EventWithContext> eventsWithContext, Map<String, EventFieldSpec> fieldSpec) {
for (final Map.Entry<String, EventFieldSpec> entry : fieldSpec.entrySet()) {
final String fieldName = entry.getKey();
final EventFieldSpec spec = entry.getValue();
for (final FieldValueProvider.Config providerConfig : spec.providers()) {
final FieldValueProvider.Factory providerFactory = fieldValueProviders.get(providerConfig.type());
if (providerFactory == null) {
LOG.error("Couldn't find field provider factory for type {}", providerConfig.type());
continue;
}
final FieldValueProvider provider = providerFactory.create(providerConfig);
for (final EventWithContext eventWithContext : eventsWithContext) {
final Event event = eventWithContext.event();
event.setField(fieldName, provider.get(fieldName, eventWithContext));
}
}
}
}
Aggregations