I want to add an ingest pipeline script that will add particular fields if host.ip falls into the CIDR notation range.
I was trying some stuff but still, that does not work
The script does not return errors but fields are not added.
CIDR block = new CIDR("10.10.0.0/21"); # or def block = new CIDR("10.10.0.0/21")
for (int i = 0; i < ctx.host?.ip?.length; ++i) {
if (block.contains(ctx["host.ip"])) {
ctx["host.bo"] = "Value1";
ctx["host.bo_name"] = "Value2";
}
}
If you can spot the error and guide me It would be very helpful.
This started to work. I was not able to manage to add a field via ctx._source... I used a set before that processor instead.
CIDR block = new CIDR("10.10.0.0/20");
for (int i = 0; i < ctx?.host?.ip.length; ++i) {
if (block.contains(ctx.host.ip[i])) {
ctx?.host.bo_name = "Value";
}
}
Now I just wonder what would be the performance impact of using runtime field instead of ingest pipeline script processor.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.