ELK使用過程中遇到的一些問題


filebeat

背景:log組件有變動,應用發布到k8s上后,filebeat不收集了。

排查過程

$ k -n kube-system logs -f filebeat-cx6jp
...
Configured paths: [/data/test/log/*.log]
...

配置確實加載了,但是沒有啟動Harvester,也就是沒有類似以下的記錄

Harvester started for file: /data/sync/test/abc.log

但是不知道為什么沒有。

filebeat.yml中加入以下內容開啟debug。(官方文檔)

logging.level: debug
logging.to_stderr: true

重啟后發現以下內容:

DEBUG	[input]	log/input.go:290   File /data/sync/test/abc.log skipped as it is a symlink.

原來是因為/data/sync/test/abc.log是個軟連,默認是不收集的。

官網一番查找,加入了symlinks: true

- type: log
     symlinks: true
     paths:
       - "/data/test/log/*.log"

解決!

The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true.

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."
    },
    "status": 400
}

我用的是第二種,添加了include_type_name

PUT _template/loges-pro-traefik?include_type_name


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM