elk

安装es

首先创建用户 和组

然后将下载的es包上传至服务器

解压后授权及所属者和属主

用root用户更改 /etc/security/limits.conf 文件


* soft nofile 65536
* hard nofile 65536
* soft nproc 65536
* hard nproc 65536

* 处换成用户名

vim /etc/sysctl.conf

vm.max_map_count=655360

退出然后刷新下 sysctl -p

vim elasticsearch.yml

http.host: 192.168.98.133
http.port: 9200


然后切换es用户 启动es

bin/elasticsearch


kibana 搭建(版本不要太高,否则会报错,本文es用的是7.7.1 kibana用的是7.1.1)

解压安装包

授权及所属组和所属者

配置文件 vim config/kibana.yml

server.port: 5601

server.host: "0.0.0.0"
elasticsearch.hosts: ["http://192.168.98.142:9200"]

保存并退出

启动kibana
./bin/kibana

logs

下载logs包

解压压缩包

在bin目录下,新建配置文件logstash.conf

input{
file{
path => "E:/lyh/software/ELK/sample/data/accounts.json"
start_position => "beginning"
type => "testdata"
codec => json{
charset => "UTF-8"
}
}
}

filter{
}

output{
elasticsearch{
hosts => "localhost:9200"
index => "logstash-%{type}"
}
}

改下IP 为本机IP

启动logs
./bin/logstash -f bin/logstash.conf --configtest

curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.3.2-x86_64.rpm  (linux filebeat下载地址)