[TOC]
## 一、概述
Filebeat是一個輕量級托運人,用于轉發和集中日志數據。Filebeat作為代理安裝在您的服務器上,監控您指定的日志文件或位置,收集日志事件,并將其轉發到[Elasticsearch](https://www.elastic.co/products/elasticsearch)或[Logstash](https://www.elastic.co/products/logstash)進行索引。
Filebeat的工作原理如下:當您啟動Filebeat時,它會啟動一個或多個輸入,這些輸入查看您為日志數據指定的位置。對于Filebeat找到的每個日志,Filebeat都會啟動一個收割機。每個收割機都會讀取新內容的單個日志,并向新日志數據tlibbeat發送,以匯總事件并將匯總的數據發送到您為Filebeat配置的輸出。

## 二、下載
[https://www.elastic.co/cn/downloads/logstash](https://www.elastic.co/cn/downloads/logstash)

獲取歷史版本:

## 三、安裝
### 3.1. 配置文件filebeat.yml

```
vim filebeat.yml
```
#### 3.1.1. 修改filebeat.inputs
其中:
>[info] paths:為項目的日志路徑;
> docType:索引名稱。elasticsearch和logstash需要使用;

```
filebeat.inputs:
- type: log
enabled: true
paths:
- /Users/herw/Workspaces/eclipse/greatwall-microservice/logs/application/*/*.log
exclude_lines: ['\sDEBUG\s\d']
exclude_files: ['sc-admin.*.log$']
fields:
docType: sys-log
project: greatwall-microservice
multiline:
pattern: '^\[\S+:\S+:\d{2,}] '
negate: true
match: after
- type: log
enabled: true
paths:
- /Users/herw/Workspaces/eclipse/greatwall-microservice/greatwall-gateway/logs/point/*.log
fields:
docType: point-log
project: greatwall-microservice
- type: log
enabled: true
paths:
- /usr/local/mysql/data/heruowendeMBP-slow.log
fields:
docType: mysqlslowlogs
exclude_lines: ['^\# Time']
multiline:
pattern: '^\# Time|^\# User'
negate: true
match: after
- type: log
enabled: true
paths:
- /Users/herw/Workspaces/eclipse/greatwall-microservice/greatwall-business/logs/audit/*.log
fields:
docType: audit-log
project: greatwall-microservice
```
#### 3.1.2. 修改output.logstash
其中:
>[info] hosts:為logstash的部署地址

```
hosts: ["localhost:5044"]
bulk_max_size: 2048
```
>[danger] 注釋elasticsearch接口,因為filebeat要輸出到logstash
> #output.elasticsearch:
> #hosts: \["localhost:9200"\]
## 四、啟動
```
./filebeat -c filebeat.yml -e
```
- 快速開始
- 項目簡介
- 快速了解
- 項目啟動
- 常見問題
- 開發計劃
- 后端手冊
- ELK【日志分析系統】
- 文檔說明
- 應用效果圖
- 運行環境
- Filebeat
- Elastsearch
- Logstash
- Kibana
- APM【鏈路跟蹤系統】
- SkyWalking
- 簡介
- server部署
- agent部署
- 本地eclipse配置
- 使用Console
- GPE【監控預警系統】
- Prometheus
- Grafana
- Exporter
- node-exporter【服務器監控】
- mysql-exporter【MySQL監控】
- elasticsearch-exporter【Elasticsearch監控】
- nacos-exporter【Nacos監控】
- redis-exporter【Redis監控】
- microservices-exporter【微服務監控】
- DFS【分布式文件系統】
- MinIO
- 注冊中心
- nacos
- 簡介
- 架構
- 部署
- 限流熔斷
- sentinel
- 軟件簡介
- Sentinel 的歷史
- Sentinel 基本概念
- Sentinel 功能和設計理念
- 熔斷降級
- Sentinel 是如何工作的
- 啟動 Sentinel 控制臺
- Zookeeper
- canal
- 簡介
- 工作原理
- MySQL準備
- canal-admin部署
- canal-deployer部署
- canal-adapter部署
- GPE監控
- 分布式任務
- xxl-job
- 簡介xxl-job
- 特性
- 接入
- demo
- 前端手冊
- vue
- 項目部署