elk elasticsearch kibana logstash metricbeat filebeat apm heartbeat elastalert 監控 alerting index elastic stack open distro for elasticsearch elastalert

ELK Lesson 17:Filebeat收Log (以yum紀錄為範例)

Yum紀錄檔位置

yum的紀錄檔預設是放置在/var/log/yum.log

調整Filebeat的設定檔

步驟1:調整filebeat.yml,開啟收檔案的input功能。

$ sudo vi /etc/filebeat/filebeat.yml

步驟2:移動到設定檔內的filebeat.inputs段落。

各種支援的input類型或模組請參考【官方網站】。

# ============================== Filebeat inputs ===============================

filebeat.inputs:

# Each - is an input. Most options can be set at the input level, so
# you can use different inputs for various configurations.
# Below are the input specific configurations.

#設定輸入的類型為log
- type: log

  # Change to true to enable this input configuration.
  #enabled: false
   #設定啟動input功能
   enabled: true

  # Paths that should be crawled and fetched. Glob based paths.
  paths:
    #- /var/log/*.log
    #指定讀取特定檔案
    - /var/log/yum.log

步驟3:重新啟動Filebeat。

$ sudo systemctl restart filebeat

步驟4:進入【Kibana】=>【Observability】=>【Logs】可以看到剛剛指定要讀取的yum.log內容已經被寫入至ELK中,並且隨時可以使用Kibana查詢。

~ END ~


,

Related posts

Latest posts