Configure authentication credentials
editConfigure authentication credentials
editWhen sending data to a secured cluster through the elasticsearch
output, Filebeat must either provide basic authentication credentials
or present a client certificate.
To configure authentication credentials for Filebeat:
-
Create a writer role that has the following privileges:
-
Cluster:
manage_index_templates,monitor, andmanage_ingest_pipelines -
Index:
writeandcreate_indexon the Filebeat indices
You can create roles from the Management / Roles UI in Kibana or through the
roleAPI. For example, the following request creates a role namedfilebeat_writer: -
Cluster:
-
If you plan to use index lifecycle management, create a role that has the following privileges. These privileges are required to load index lifecycle policies and create and manage rollover indices:
-
Cluster:
manage_ilm -
Index:
write,create_index,manage, andmanage_ilmon the Filebeat indicesPOST _xpack/security/role/filebeat_ilm { "cluster": ["manage_ilm"], "indices": [ { "names": [ "filebeat-*","shrink-filebeat-*"], "privileges": ["write","create_index","manage","manage_ilm"] } ] }
-
Cluster:
-
Assign the writer role to the user that Filebeat will use to connect to Elasticsearch. Make sure you also assign any roles that are required for specific features. For the list of features and required roles, see Filebeat features that require authorization.
-
To authenticate as a native user, create a user for Filebeat to use internally and assign it the writer role, plus any other roles that are needed.
You can create users from the Management / Users UI in Kibana or through the
userAPI. For example, following request creates a user namedfilebeat_internalthat has thefilebeat_writerandkibana_userroles:POST /_xpack/security/user/filebeat_internal { "password" : "YOUR_PASSWORD", "roles" : [ "filebeat_writer","kibana_user"], "full_name" : "Internal Filebeat User" } -
To use PKI authentication, assign the writer role, plus any other roles that are needed, in the
role_mapping.ymlconfiguration file. Specify the user by the distinguished name that appears in its certificate:filebeat_writer: - "cn=Internal Filebeat User,ou=example,o=com" kibana_user: - "cn=Internal Filebeat User,ou=example,o=com"
For more information, see Using Role Mapping Files.
-
-
In the Filebeat configuration file, specify authentication credentials for the
elasticsearchoutput:-
To use basic authentication, configure the
usernameandpasswordsettings. For example, the following Filebeat output configuration uses the nativefilebeat_internaluser to connect to Elasticsearch:output.elasticsearch: hosts: ["localhost:9200"] username: "filebeat_internal" password: "YOUR_PASSWORD"
You created this user earlier.
The example shows a hard-coded password, but you should store sensitive values in the secrets keystore.
-
To use PKI authentication, configure the
certificateandkeysettings:
-