ELasticSearch Datasource through Yaml in Grafana

  • What Grafana version and what operating system are you using?
  • Grafana Version: v9.1.6
  • OS: Kubernetes, Deployed Through Helm
  • What are you trying to achieve?
  • Add Elastic Search datasource through YAML format in the helm chart deployment
  • How are you trying to achieve it?
  # Setup Data Source (prometheus)
  datasources:
    datasources.yaml:
      apiVersion: 1
      datasources:
        - name: Prometheus
          type: prometheus
          url: http://prometheus-server
          access: proxy
          isDefault: true
        - name: Elastic
          type: elasticsearch
          url: http://elasticsearch-master:9200
          password: ""
          user: ""
          access: proxy
          isDefault: false
          jsonData:
            indexName: vds_server_access.log*
            esVersion: 7.10+
            logLevelField: ""
            logMessageField: ""
            maxConcurrentShardRequests: 5
            timeField: "@timestamp"
          readonly: false

  • What happened?
  • What did you expect to happen?
  • Set the indexName field in the dashboard datasource through yaml in the helm chart
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
  • No errors received

Try database field, example:

  - name: Elasticsearch
    type: elasticsearch
    access: proxy
    url: <url>
    basicAuth: true
    basicAuthUser: <user>
    database: <index name>
    isDefault: false
    jsonData:
      esVersion: 7.10.0
      logMessageField: full_message
      timeField: "@timestamp"
      timeout: 300
      tlsSkipVerify: true
      maxConcurrentShardRequests: 10
    secureJsonData:
      basicAuthPassword: <password>

I would recommend to check doc - there are some good examples usually.
You may configure datasource manually and then check response from API (/api/datasources) - that particular datasource JSON structure can be mapped to YAML tructure easily (except secrets-secureJsonData, which has special secure handling).

1 Like

@jangaraj Thank You that information was really helpful

thanks @jangaraj that worked!