- 參考:stackflow上的解釋
- filebeat 版本 : 7.4.2
- elasticsearch 版本: 7.4.2
- Kibana 7.4.2
- 在自定義filebeat的nginx module的pipeline名字的時候,一直失敗,也找不到解決方案,最後看了一下github上的issue,才發現原來filebeat的module的pipeline名字無法自定義。。。在這裏記錄一下替代方案。
filebeats的module的pipeline的名字是由程序生成的,無法自定義,而且覆蓋pipeline的name這個操作貌似也是行不通的。
// formatPipelineID generates the ID to be used for the pipeline ID in Elasticsearch
func formatPipelineID(module, fileset, path, beatVersion string) string {
return fmt.Sprintf("filebeat-%s-%s-%s-%s", beatVersion, module, fileset, removeExt(filepath.Base(path)))
}
因此如果要自定義pipeline的名字,只能通過在配置文件配置inputs,實現自定義的日誌輸入。
下面以nginx爲例
- filebeat.yml
filebeat.overwrite_pipelines: true filebeat.inputs: - type: log enabled: true paths: - D:\\nginx-1.16.0\\logs\\access*.log pipeline: huawei-nginx-access
- huawei-nginx-access這個pipeline則可以使用kibana的dev工具,採用PUT請求更新創建,並使用GET查看是否創建成功。
PUT _ingest/pipeline/huawei-nginx-access
{boby}
GET _ingest/pipeline/huawei-nginx-access