天天看點

配置Loki

1.loki-local-config.yaml配置

auth_enabled: false

server:
  http_listen_port: 3100

ingester:
  lifecycler:
    address: 127.0.0.1
    ring:
      kvstore:
        store: inmemory
      replication_factor: 1
    final_sleep: 0s
  chunk_idle_period: 5m
  chunk_retain_period: 30s
  max_transfer_retries: 0

schema_config:
  configs:
    - from: 2019-04-15
      store: boltdb
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 168h

storage_config:
  boltdb:
    directory: /tmp/loki/index

  filesystem:
    directory: /tmp/loki/chunks

limits_config:
  enforce_metric_name: false
  reject_old_samples: true
  reject_old_samples_max_age: 168h

chunk_store_config:
  max_look_back_period: 0s

table_manager:
  retention_deletes_enabled: false
  retention_period: 0s      

參數說明:

ingester 參數說明
auth_enabled   通過X-Scope-OrgID标頭啟用身份驗證,該标頭必須存在
http_listen_port 端口号
lifecycler     配置ingester的生命周期如何運作,以及它将在哪裡注冊以進行發現。
   kvstore     後端存儲。支援的值為consul, etcd, inmemory, memberlist    
   replication_factor 要寫入和讀取的攝取器數。必須至少為1
   final_sleep 退出前休眠的持續時間,以確定名額被清除
chunk_idle_period 在沒有更新之前,塊應該在記憶體中保留多長時間,如果沒有達到最大塊大小,将被重新整理。這意味着在某個特定的時間之後,半個空的塊仍然會被重新整理,隻要他們沒有進一步的活動。
chunk_retain_period 塊在存儲完成後應該在記憶體中保留多長時間後被重新整理。
max_transfer_retries 離開前嘗試轉移區塊的次數,0等于未完成傳輸。   

schema_config配置塊索引架構及其存儲位置的參數說明
from 應建立索引桶的第一天的日期。使用如果這是您唯一的句點配置,則為過去的日期,否則請在希望架構切換時使用日期。
store 用于索引的存儲 Either aws, gcp, bigtable, bigtable-hashed,cassandra, or boltdb.
object_store 用于存儲塊,Either aws, aws-dynamo, azure, gcp,bigtable, gcs, cassandra, swift or filesystem
schema 要使用的架構版本,目前建議的架構是v11。
index 配置如何更新和存儲索引
  prefix  所有期間表的表字首
  period  有效期預設是7天

storage_config 配置Loki将在何處存儲資料。  

limits_config 配置每個租戶或全局的限制
  enforce_metric_name 強制每個樣本都有一個度量标準名稱
  reject_old_samples  舊樣品是否會被拒收
  reject_old_samples_max_age 拒絕之前接受的最大樣本年齡

chunk_store_config  塊配置如何緩存塊以及将塊儲存到後備存儲之前要等待多長時間。
  max_look_back_period 限制可以查詢多長時間的資料。 預設設定為禁用。應始終将其設定為小于或等于在table_manager.retention_period中設定的内容。

table_manager 配置表管理器以保留
  retention_deletes_enabled  Master 'on-switch' for table retention deletions
  retention_period 删除表将保留多久。 禁用0秒,删除。 保留期必須是索引/塊的倍數 table“ period”(請參見期間配置)      

官方位址:​​https://github.com/grafana/loki/blob/master/docs/configuration/README.md​​

​​https://github.com/grafana/loki/blob/master/docs/clients/promtail/configuration.md ​​

​​https://github.com/grafana/loki/blob/master/docs/clients/promtail/scraping.md#syslog-target​​

​​https://github.com/grafana/loki/blob/master/docs/operations/storage/table-manager.md​​

​​https://github.com/grafana/loki/blob/master/docs/operations/storage/retention.md​​

​​https://github.com/grafana/loki/blob/master/docs/operations/storage/filesystem.md​​