Skip to content

Commit 0c55e14

Browse files
authored
id->event bridge: handle array types as lists (#146)
* id->event bridge: handle array types as lists * changelog/bump: include changes since 0.1.9 * docs: enumerate supported database types
1 parent ffe5981 commit 0c55e14

File tree

5 files changed

+39
-7
lines changed

5 files changed

+39
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.10
2+
- Fixes handling of array-type event fields by treating them as lists [#146](https://github.com/elastic/logstash-filter-elastic_integration/pull/146)
3+
- Syncs with Elasticsearch 8.14, including support for new user-provided GeoIP database types `ConnectionType`, `Domain` and `Isp` [#147](https://github.com/elastic/logstash-filter-elastic_integration/pull/147)
4+
15
## 0.1.9
26
- [DOC] Removes Tech Preview label and adds link to extending integrations topic in LSR [#142](https://github.com/elastic/logstash-filter-elastic_integration/pull/142)
37

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.9
1+
0.1.10

docs/index.asciidoc

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,26 @@ By using managed databases you accept and agree to the https://www.maxmind.com/e
336336

337337
You may instead configure this plugin with the path to a local directory containing database files.
338338

339-
Databases are registered by file name, and most integrations rely on databases being present named:
340-
341-
* `GeoLite2-ASN.mmdb`
342-
* `GeoLite2-City.mmdb`
339+
This plugin will discover all regular files with the `.mmdb` suffix in the provided directory, and make each available by its file name to the GeoIp processors in integration pipelines.
340+
It expects the files it finds to be in the MaxMind DB format with one of the following database types:
341+
342+
* `AnonymousIp`
343+
* `ASN`
344+
* `City`
345+
* `Country`
346+
* `ConnectionType`
347+
* `Domain`
348+
* `Enterprise`
349+
* `Isp`
350+
351+
[NOTE]
352+
====
353+
Most integrations rely on databases being present named _exactly_:
354+
355+
* `GeoLite2-ASN.mmdb`,
356+
* `GeoLite2-City.mmdb`, or
343357
* `GeoLite2-Country.mmdb`
344-
345-
This plugin will discover any regular file with the `.mmdb` suffix in the provided directory, and expects the files it finds to be in the MaxMind DB format.
358+
====
346359

347360
[id="plugins-{type}s-{plugin}-hosts"]
348361
===== `hosts`

src/main/java/co/elastic/logstash/filters/elasticintegration/IngestDuplexMarshaller.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.time.ZoneId;
2323
import java.time.ZonedDateTime;
2424
import java.util.ArrayList;
25+
import java.util.Arrays;
2526
import java.util.Collection;
2627
import java.util.Collections;
2728
import java.util.HashMap;
@@ -278,6 +279,8 @@ private Object internalize(final @Nullable Object externalObject) {
278279
return internalize(externalSet);
279280
} else if (externalObject instanceof ZonedDateTime zonedDateTime) {
280281
return new Timestamp(zonedDateTime.toInstant());
282+
} else if (externalObject.getClass().isArray()) {
283+
return internalize(Arrays.asList((Object[]) externalObject));
281284
} else {
282285
// Naively fall through to Logstash's Javafier,
283286
// which has identity converters for known-safe types

src/test/java/co/elastic/logstash/filters/elasticintegration/IngestDuplexMarshallerTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,18 @@ void ingestDocToEventIncludingReservedTagsFieldWithListOfStringShape() {
365365
});
366366
}
367367

368+
@Test void ingestDocToEventIncludingArrayType() {
369+
final Event input = BasicEventFactory.INSTANCE.newEvent(Map.of("message", "hello, world"));
370+
final IngestDocument intermediate = idm.toIngestDocument(input);
371+
372+
final String[] arrayValueInSource = new String[]{"this", "that"};
373+
intermediate.setFieldValue("deeply.nested", arrayValueInSource);
374+
375+
validateEvent(idm.toLogstashEvent(intermediate), (output) -> {
376+
assertThat(output, includesField("[deeply][nested]").withValue(equalTo(List.of("this", "that"))));
377+
});
378+
}
379+
368380

369381
@Test
370382
void eventToIngestDocFieldWithNestedZonedDateTimeValue() {

0 commit comments

Comments
 (0)