I enabled auditing in my cluster using x-pack. In the log file I can see that Kibana is constantly sending monitoring and health check requests to the cluster, even when there is no user activity. Every few seconds I get a bunch of messages like this:
[2017-03-20T23:08:04,587] [transport] [access_granted] origin_type=[rest], origin_address=[192.168.1.240], principal=[kibana], action=[cluster:monitor/main], request=[MainRequest]
[2017-03-20T23:08:04,592] [transport] [access_granted] origin_type=[rest], origin_address=[192.168.1.240], principal=[kibana], action=[cluster:monitor/nodes/info], request=[NodesInfoRequest]
[2017-03-20T23:08:04,593] [transport] [access_granted] origin_type=[rest], origin_address=[192.168.1.240], principal=[kibana], action=[cluster:monitor/nodes/info[n]], request=[NodeInfoRequest]
[2017-03-20T23:08:04,609] [transport] [access_granted] origin_type=[rest], origin_address=[192.168.1.240], principal=[kibana], action=[cluster:monitor/nodes/info], request=[NodesInfoRequest]
[2017-03-20T23:08:04,610] [transport] [access_granted] origin_type=[rest], origin_address=[192.168.1.240], principal=[kibana], action=[cluster:monitor/nodes/info[n]], request=[NodeInfoRequest]
[2017-03-20T23:08:04,614] [transport] [access_granted] origin_type=[rest], origin_address=[192.168.1.240], principal=[kibana], action=[cluster:monitor/health], indices=[.kibana], request=[ClusterHealthRequest]
This clutters the log and making it hard to find the really important messages. On the other hand, I cannot just filter those messages out based on IP address or user name, since I want Kibana "real" activity created by users to be caught by the audit process.
Does anyone know how to stop those messages from appearing in the audit log file ?
Oh, there is. You need to add this to the elasticsearch.yml file. xpack.security.audit.outputs: [ index, logfile ]
But the filter will only work for the log file, although you can browse them a lot more easily in ES + Kibana.
There are a few drawbacks to logging to a index only, this is why with the options from before it will log both to file and ES.
Read more about them here (it's in the first article of the page): https://www.elastic.co/guide/en/x-pack/current/auditing.html
I already have audit log sent to index using the method described above, and i've added exclusions for authentication_success, however i cannot do so for the access_granted since the messages i'm most interested in other than failed auith comes from those messages (deletion events)
This in turn generates 3.2 to 3.3 million events per day for the kibana and logstash users alone, since i need a minimum retention of 90 days for active logs and a year for archived logs that's a lot of clutter.
If there are no filtering options for the audit logs sent directly index other than events exclusion would it be something that's included in the enhancement request you've described above or would a new request need to be created.
In the meanwhile i'm thinking i'll either create a daily cornt job to perform a delete_by_query or simply ingest the logfile through logstash.
It doesn't seem to work for me.
I tried the very same regular expression you suggested, and it did not like the hyphens (even when I escaped them) and threw errors.
I tried a little different regular expression: .principal=[Kibana].|.action=[.monitoring.*]
And it just ignored it and kept on flooding the log with audit messages that were supposed to be filtered out.
I am not that great with regular expressions, however, trying to filter out Kibana monitoring messages, I came up with this regexp:
principal=.Kibana.|.indices=..(monitoring-data-2|kibana)..|action=.*cluster:monitor*
I tested it with an online Java regexp tester and it was good and matched all the required messages. But when I inserted it to log4j2.properties and restarted, it seems like Elasticsearch is completely ignoring it !
This is what eventually eliminated all unwanted messages:
.*principal=.kibana...action=.cluster:monitor.*|.*action=.cluster:admin.*|.*indices=..kibana.,.*|.*indices=..\*.,.*
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.