Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux Can';无法在prometheus上启用查询日志_Linux_Shell_Yaml_Prometheus - Fatal编程技术网

Linux Can';无法在prometheus上启用查询日志

Linux Can';无法在prometheus上启用查询日志,linux,shell,yaml,prometheus,Linux,Shell,Yaml,Prometheus,我遵循了以下文档:为了在我们的prometheus服务器上启用查询日志,我对配置进行了如下编辑: # my global config global: scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation_interval: 15s # Evaluate rules every 15 seconds. The default

我遵循了以下文档:为了在我们的prometheus服务器上启用查询日志,我对配置进行了如下编辑:

# my global config
global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  query_log_file: /app/prometheus/query.log
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
       - localhost:9093

# Load rules once and periodically evaluate them according to the global evaluation_interval.
rule_files:
  - "prometheus_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label job=<job_name> to any timeseries scraped from this config.
  - job_name: 'prometheus'
    scrape_timeout: 30s
    scrape_interval: 60s
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:9090']
  - job_name: 'node_prometheus'
    scrape_timeout: 30s
    scrape_interval: 60s
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:9100']
  - job_name: 'grafana'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
# mettre ALB grafana
    - targets: ['${grafana_dns}']

  - job_name: 'sqs_exporter'
    scrape_interval: 5m
    scrape_timeout: 2m
    static_configs:
    - targets: ['localhost:9434']

  - job_name: 'cloudwatch_exporter'
    scrape_interval: 5m
    scrape_timeout: 2m
    static_configs:
    - targets: ['localhost:9106']

  - job_name: '_metrics'
    metric_relabel_configs:
    relabel_configs:
     - source_labels:
       - __meta_ec2_platform
       action: keep
       regex: .*windows.*
     - action: labelmap
       regex: __meta_ec2_tag_(.*)
       replacement: \$1
    ec2_sd_configs:
      - region: ${aws_region}
        port: 9543
        role_arn: arn:aws:iam::xxxxxxxxxxxx:role/prometheus_readonly
        filters:
          - name: tag:app
            values:
              - cloudapp
      - region: ${aws_region}
        port: 9543
        role_arn: arn:aws:iam::xxxxxxxxxxxxx:role/prometheus_readonly
        filters:
          - name: tag:longcode
            values:
              - gdp_

  - job_name: 'cadvisor'
    static_configs:
    - targets: ['localhost:8080']

  - job_name: 'elasticbeanstalk_exporter'
    static_configs:
    - targets: ['localhost:9552']
然后:

sudo systemctl status prometheus -l
以下是我得到的错误:

Jul 23 14:39:23 ip-prometheus: level=error ts=2020-07-23T14:39:23.931Z caller=main.go:583 msg="Error reloading config" err="couldn't load configuration (--config.file=\"/usr/local/prometheus/prometheus/prometheus.yml\"): parsing YAML file /usr/local/prometheus/prometheus/prometheus.yml: yaml: unmarshal errors:\n  line 5: field query_log_file not found in type config.plain"

你能帮忙吗?

普罗米修斯的版本是什么?
您可以从v2.16.0开始使用“查询日志文件”。

哦,我的普罗米修斯版本是2.14.0
Jul 23 14:39:23 ip-prometheus: level=error ts=2020-07-23T14:39:23.931Z caller=main.go:583 msg="Error reloading config" err="couldn't load configuration (--config.file=\"/usr/local/prometheus/prometheus/prometheus.yml\"): parsing YAML file /usr/local/prometheus/prometheus/prometheus.yml: yaml: unmarshal errors:\n  line 5: field query_log_file not found in type config.plain"