簡體   English   中英

如何在filebeat中立即將日志推送到elasticsearch?

[英]How to push logs to elasticsearch in filebeat instantly?

聽到是我的 filebeat.yml

filebeat.inputs:
- type: log
  enabled: true
  paths:
    - ../typescript/rate-limit-test/logs/*.log
  json.message_key: "message"
  json.keys_under_root: true
  json.overwrite_keys: true
  scan_frequency: 1s

filebeat.config.modules:
  path: ${path.config}/modules.d/*.yml
  reload.enabled: false

setup.template.settings:
  index.number_of_shards: 1

logging.level: debug

output.elasticsearch:
  hosts: ["34.97.108.113:9200"]
  index: "filebeat-%{+yyyy-MM-dd}"
setup.template:
  name: 'filebeat'
  pattern: 'filebeat-*'
  enabled: true
setup.template.overwrite: true
setup.template.append_fields:
- name: time
  type: date

processors:
  - drop_fields:
      fields: ["agent","host","ecs","input","log"]

setup.ilm.enabled: false`

我更改了 scan_frequency 但 elasticsearch 無法更快地獲取日志

如何立即在 elasticsearch 中獲取日志?

請幫我..

在elasticsearch 中永遠不會有“即時”可用的日志行。 文件需要觀察大量的更改或時間,然后新添加的行需要在批量請求中發送到 elasticsearch 並索引到正確集群節點上的適當分片中。 網絡延遲、TLS、身份驗證 + 授權、並發寫入/搜索負載:所有這些都會影響“即時”體驗。

日志攝取和 NRT(近實時搜索)的速度取決於 elasticsearch 和 filebeat 中的許多因素和配置選項。

關於為索引速度調整彈性搜索,請查看此文檔,並應用您尚未錯過的內容。 簡要概述:

  • 禁用交換並啟用內存鎖定( bootstrap.memory_lock: true
  • 考慮減少index.refresh_interval (默認為 1s),以便更頻繁地刷新文檔(在集群中產生更多的 IO)

對於 Filebeat, 也有關於 Tuning 的很好的文檔,但總的來說,我看到以下選項:

  • 嘗試不同的output.elasticsarch.bulk_max_size值(默認批量大小為 50)並監控攝取速度。 對於每個集群配置,都有不同的最佳設置。
  • 高負載場景,當日志寫入速度快時,考慮增加output.elasticsarch.workers數量output.elasticsarch.workers (默認為1)
  • 在相反的情況下,僅寫入幾行日志,請考慮增加收割機的close_inactivescan_frequency值。 指定更合適的backoff將影響 Filebeat 檢查文件更新的積極程度。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM