icinga2 icon indicating copy to clipboard operation
icinga2 copied to clipboard

More options to filter the events sent to Elasticsearch

Open rustyricky opened this issue 8 years ago • 4 comments

It would be great if we could filter the event types sent to Elasticsearch using the ElastichsearchWriter. Currently we can disable performance data but have no options for further filtering.

Suggestion: Provide toggles for the different event types similar to the performance metrics toggle, e.g.:

enable_send_checkresults
enable_send_state_transitions_host
enable_send_state_transitions_service
...

rustyricky avatar Apr 09 '18 12:04 rustyricky

I'm not really a friend of filtering away such events, but keep a certain default. Performance data metrics is an opt-in feature, although I'm not sure if it makes sense in Elasticsearch.

This behaves the same as with the GelfWriter where this wasn't really problem. What's the idea behind disabling such events?

dnsmichi avatar Apr 09 '18 18:04 dnsmichi

I'm building dashboards which merge data from different sources (InfluxDB, Elasticsearch) to give a comprehensive overview of the infrastructure. One component is an event stream which will among other things display state transitions from Icinga which are collected through the ElasticsearchWriter. Seeing that state transitions only make up only a very small amount of the data pushed to Elasticsearch as I'm handling everything else with the InfluxWriter it would be useful if we would not collect them in the first place.

rustyricky avatar Apr 09 '18 18:04 rustyricky

Sounds legit. There's no plans to provide such filters though at the moment.

dnsmichi avatar Apr 17 '18 08:04 dnsmichi

Hello,

this "filtering" is something that can be achieved with Elasticsearch/OpenSearch.

You can do this by creating a field mapping template for the index, then setting the dynamic property to false and specifying which fields you want to keep. See https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/dynamic

false New fields are ignored. These fields will not be indexed or searchable, but will still appear in the _source field of returned hits. These fields will not be added to the mapping, and new fields must be added explicitly.

Example:

{
    "template": {
        "mappings": {
            "dynamic" : "false",
            "properties": {
                "@timestamp":    { "type": "date" },
                "timestamp":     { "type": "date", "format": "epoch_millis" },
                "check_command": { "type": "keyword" },
                "host":    { "type": "keyword" },
                "service": { "type": "keyword" },
            }
        }
    },
    "_meta": {
        "description": "Mappings Icinga2 fields"
    }
}
{
    "index_patterns": ["icinga2*"],
    "data_stream": { },
    "composed_of": [ "perfdata-mappings" ],
    "priority": 500,
    "_meta": {
        "description": "Template for Icinga2"
    }
}

martialblog avatar Jul 25 '25 13:07 martialblog