CentOS與FreeBSD環境下安裝filebeat

業務服務器CentOS與FreeBSD共存(痛苦囧。。。)git

CentOS

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
vim /etc/yum.repos.d/logstash.repo
[logstash-5.x]
name=Elastic repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

yum install filebeat -y

先不要啓動與開機啓動 還沒設置收集工做的配置文件。github

FreeBSD

須要本身編譯vim

sh
export GOPATH=$HOME/go

mkdir -p ${GOPATH}/src/github.com/elastic
cd ${GOPATH}/src/github.com/elastic
git clone https://github.com/elastic/beats.git
git checkout origin/5.6
cd ${GOPATH}/src/github.com/elastic/beats/filebeat
vim ../libbeat/scripts/Makefile
大約在76行
 76 #${BEAT_NAME}: $(GOFILES_ALL) ## @build build the beat application
 77 .DEFAULT:
 78         go build
改爲 .DEFAULT 注意使用tab鍵對go build縮進。

make

cd ..

tar zcvf filebeat.tar.gz filebeat

最後 filebeat.tar.gz 這個壓縮包就是filebeat在FreeBSD下能夠直接運行了。centos

相關文章
相關標籤/搜索