skip invalid entries
This commit is contained in:
@@ -116,15 +116,21 @@ public class TcpIngestor implements Ingestor, AutoCloseable, DisposableBean {
|
|||||||
public Optional<Entry> createEntry(final Map<String, Object> map) {
|
public Optional<Entry> createEntry(final Map<String, Object> map) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
final OffsetDateTime date = getDate(map);
|
if (map.containsKey("duration")
|
||||||
final long duration = (int) map.get("duration");
|
&& map.containsKey("@timestamp")) {
|
||||||
|
final OffsetDateTime date = getDate(map);
|
||||||
|
final long duration = (int) map.get("duration");
|
||||||
|
|
||||||
final Tags tags = createTags(map);
|
final Tags tags = createTags(map);
|
||||||
|
|
||||||
final Entry entry = new Entry(date, duration, tags);
|
final Entry entry = new Entry(date, duration, tags);
|
||||||
return Optional.of(entry);
|
return Optional.of(entry);
|
||||||
|
} else {
|
||||||
|
LOGGER.info("Skipping invalid entry: " + map);
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
LOGGER.error("Failed to create entry.", e);
|
LOGGER.error("Failed to create entry from map: " + map, e);
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user