elk日志分析

首先安装一下jdk

安装elk日志分析文件系统集群

挂载elk的光盘

[root@centos ~]# mount /dev/cdrom /mnt

解压tar包

[root@centos ~]# tar zxvf /mnt/node-v8.2.1.tar.gz -C /usr/src

将usr/src/下的node移动到usr下的local下的node

Cd /usr/local/node

安装

./configure && make && make install

 

用tar包安装

[root@centos ~]# rpm -ivh /mnt/elasticsearch-5.5.0.rpm

root@centos01 ~]# vim /etc/elasticsearch/elasticsearch.yml
        18 cluster.name: my-elk                                            //群集名字
        25 node.name: centos01                                            //节点计算机名
        46 bootstrap.memory_lock: false                                    //不锁定内存
        59 network.host: 192.168.100.10                                    //监听IP
        64 http.port: 9200                                                //监听端口
        74 discovery.zen.ping.unicast.hosts: ["centos01", "centos02"]

末行模式输入:x保存退出

将服务设置为开机自启

[root@centos01 ~]# systemctl daemon-reload
        [root@centos01 ~]# systemctl start elasticsearch.service
        [root@centos01 ~]# systemctl enable elasticsearch.service

监听端口

[root@centos01 ~]# netstat -anptu | grep 9200

安装phantomjs 

用tar包安装

[root@centos01 bin]# cp phantomjs /usr/local/bin/
[root@centos01 bin]# chmod +x /usr/local/bin/phantomjs 

安装elasticsearch-head 

[root@centos elasticsearch-head]# tar zxvf /mnt/elasticsearch-head.tar.gz -C/usr/src

[root@centos elasticsearch-head]# mv /usr/src/elasticsearch-head/ /usr/local/

[root@centos elasticsearch-head]# cd /usr/local/elasticsearch-head/

[root@centos elasticsearch-head]# npm install

然后重新启动服务

修改为9200

[root@centos ~]# vim /usr/local/elasticsearch-head/_site/app.js

修改为9100

[root@centos ~]# vim /usr/local/elasticsearch-head/Gruntfile.js

启动服务
        [root@centos01 ~]# cd /usr/local/elasticsearch-head/
        [root@centos01 elasticsearch-head]# npm run start&

监听9100端口

netstat -anptu | grep 9100

访问成功

安装配置logstash

首先安装apache

[root@centos ~]# rm -rf /etc/yum.repos.d/C*

[root@centos ~]# mount /dev/cdrom /mnt

[root@centos ~]# yum -y install httpd

[root@centos ~]# echo "www.benet.com" > /var/www/html/index.html

[root@centos ~]# systemctl start httpd
[root@centos ~]# systemctl enabled httpd

rpm包安装

[root@centos ~]# rpm -ivh logstash-5.5.1.rpm

做一个软连接

[root@centos ~]# ln -s /usr/share/logstash/bin/logstash /usr/local/bin/

设置开机自启

[root@centos ~]# systemctl start logstash
[root@centos ~]# systemctl enable logstash

插入测试数据

        [root@centos03 ~]# logstash -e 'input { stdin{}} output { stdout{}}'
        [root@centos03 ~]# logstash -e 'input { stdin{}} output { stdout{ codec=>rubydebug}}'
        [root@centos03 ~]# logstash -e 'input { stdin{}} output { elasticsearch{hosts => ["192.168.100.10:9200"]}}'

采集apache日志

[root@centos ~]# chmod o+r /var/log/httpd/access_log 
[root@centos ~]# touch /etc/logstash/conf.d/apache.conf
[root@centos ~]# chmod +x /etc/logstash/conf.d/apache.conf 
[root@centos ~]# vim /etc/logstash/conf.d/apache.conf

检查日志采集文件

[root@centos ~]# logstash -f /etc/logstash/conf.d/apache.conf

没问题重启

[root@centos ~]# systemctl restart logstash.service

安装配置kibana

rpm -ivh /mnt/kibana-5.5.1-x86_64.rpm

修改配置文件,并设置开机自启

[root@centos ~]# vim /etc/kibana/kibana.yml

        3 server.port: 5601
        9 server.host: "192.168.100.10"
        24 elasticsearch.url: "http://192.168.100.10:9200
[root@centos ~]# systemctl start kibana
[root@centos ~]# systemctl enable kibana

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

过客不予秋风

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值