server:http_listen_port:9080grpc_listen_port:0positions:filename:/var/log/positions.yaml# 这个位置需要是可以被promtail写入的client:url:http://ip_or_hostname_where_Loki_run:3100/loki/api/v1/push# 抓取配置scrape_configs:-job_name:systempipeline_stages:static_configs:-targets:-localhostlabels:job...
scrape_configs: - job_name: apt-dpkg file_sd_configs: - files: - /etc/promtail/dpkg-apt.yaml refresh_interval: 5m ``` The targets to be scraped by Promtail are defined in `/etc/promtail/dpkg-apt.yaml`. In fact, Promtail read the target to scrape in the list of file provided...
server:http_listen_address:0.0.0.0http_listen_port:19080grpc_listen_port:0positions:filename:/logs/loki_positions.yaml ignore_invalid_yaml:trueclients:-url:http://loki:3100/loki/api/v1/push scrape_configs:-job_name:service_log file_sd_configs:-files:-/configs/*.yaml refresh_interval: 1m #...
# #static_configs: # #file_sd_configs: # Custom scrape_configs together with the default ones in the configmap extraScrapeConfigs: # 收集类似 /data0/log-data/basketball-all-api/stg/basketball-all-api-20201026182255-8dd968e-75c9bc469f-wtfxh/e4179a7b-d505-4b7b-ae66-ed62906fa596/basketball...
四、详解Prometheus服务发现之kubernetes_sd_configs 目前,在Kubernetes下,Prometheus 通过与 Kubernetes API 集成主要支持5种服务发现模式又叫角色role:Node、Service、Pod、Endpoints、Ingress。不同的服务发现模式适用于不同的场景,例如:node适用于与主机相关的监控资源,如节点中运行的Kubernetes 组件状态、节点上运行的容器...
file_sd_config 基于文件的服务发现提供了一种更通用的方式来配置静态目标。它读取一组包含零个或多个 <static_config> 列表的文件。对所有定义文件的改变通过监视磁盘变化来应用。文件可以以 YAML 或 JSON 格式提供,JSON 文件必须包含一个静态配置的列表,使用这种格式。
_push_api_config>]# 描述了如何 relabel 目标,以确定是否应该对其进行处理relabel_configs:-[<relabel_config>]# 抓取日志静态目标配置static_configs:-[<static_config>]# 包含要抓取的目标文件file_sd_configs:-[<file_sd_configs>]# 描述了如何发现在同一主机上运行的 Kubernetes 服务kubernetes_sd_configs:-...
scrape_configs:-job_name:kubernetes-pods-namekubernetes_sd_configs:...pipeline_stages:# 这个阶段只有在被抓取地目标有一个标签名为 name 且值为 promtail 地时候才会执行-match:selector:'{name="promtail"}'stages:# regex 阶段解析出一个 level、timestamp 与 component,在该阶段结束时,这几个值只为 ...
docker_sd_configs: 通过Docker API自动发现容器,并提取相关元数据。 relabel_configs: 根据容器的标签来重标记日志,以便后续过滤与查询时使用。 验证设置 一旦配置完成,可以使用以下命令来验证Promtail是否正常运行,并确保它正在接收Docker容器的日志: curlhttp://localhost:9080/metrics ...
scrape_configs:- job_name: kubernetes-pods-namekubernetes_sd_configs: ...pipeline_stages:# 这个阶段只有在被抓取地目标有一个标签名为 name 且值为 promtail 地时候才会执行- match:selector: '{name="promtail"}'stages:# regex 阶段解析出一个 level、timestamp 与 component,在该阶段结束时,这几个值...