May I know if it is possible to use Grafana to get data from Elasticsearch using API keys? I understand the current method is to ‘Add as data source’ by specifying a direct connection (port) from Elasticsearch’s indexes, but is it possible to use API keys to perform the same?
Does elasticsearch have api keys?
yes elasticsearch do habe API keys which can be exposed to be consumed by other apps. however how do i get Grafana to consume those elasticsearch API keys?
If you use datasource provisioning for creating your datasource you can define custom http headers, for example:
apiVersion: 1 datasources: - name: Elastic type: elasticsearch access: proxy database: "[metrics-]YYYY.MM.DD" url: http://localhost:9200 jsonData: interval: Daily timeField: "@timestamp" httpHeaderName1: "Authorization" httpHeaderName2: "X-Custom" secureJsonData: httpHeaderValue1: "Bearer uDAfrDnvi08QfuP22BWQNxso5LH3Q1iWYFvcRb_yQ70" httpHeaderValue2: "custom value"
For further information please refer to pull request.