Elasticsearch
Store the entries in an Elasticsearch index.
Overview
| Package | Reads | Purge | Setup |
|---|---|---|---|
elasticsearch/elasticsearch | Yes | Yes | Yes |
The commands, the EasyAdmin viewer and ReaderInterface can read this output. audit-log:purge and audit-log:setup work with it. See Outputs.
Enable the output
symfonycorp_audit_log:
outputs:
elasticsearch:
client: Elastic\Elasticsearch\Client # service id. Register this client yourself
index: audit_logclient: the service id of the Elasticsearch client. Default:Elastic\Elasticsearch\Client. The bundle does not register this client: register it yourself.index: the index of the entries. Default:audit_log.auto_setup: create the index on the first write. Default:false. See Create the index.
Create the index
The output does not create its index by default. Without it, a write can fail, and the bundle only logs the failure. Run the setup command when you deploy. It does not change an index that exists:
$ bin/console audit-log:setup --output=elasticsearchIn development and in tests, you can set auto_setup: true to create the index on the first write. Do not use it in production.
Indexed context - the index has one field for each key of indexed_context. When you change this list, create a new index before you deploy. The context filter does not find the entries written before the change.
Result window
offset + limit cannot be more than index.max_result_window (10000 by default). This applies to audit-log:list, the EasyAdmin list and ReaderInterface. Narrow the read with from, to or context, or raise this setting on the index.