CentOS 7 Logstash二进制安装和启动

guiyun affiliate

ELK  官网和下载地址:https://www.elastic.co/cn/downloads/


Logstash的安装

1.      依赖于Java环境

2.      下载二进制安装文件

3.      解压到对应目录完成安装/usr/local/

 

Logstash的安装脚本

cd /usr/local/src

tar -zxf logstash-6.6.0.tar.gz

 mv logstash-6.6.0 /usr/local/

 

Logstash的JVM配置文件更新/usr/local/logstash-6.6.0/config/jvm.options

-Xms200M

-Xmx200M

 

Logstash支持

4.      Logstash分为输入、输出

5.      输入:标准输入、日志等

6.      输出:标准输出、ES等

 

Logstash最简单配置/usr/local/logstash-6.6.0/config/logstash.conf

input{

  stdin{}

}

output{

  stdout{

    codec=>rubydebug

  }

}

 

Logstash的启动和测试

7.      yum install haveged -y; systemctl enable haveged; systemctl start haveged

8.      前台启动:/usr/local/logstash-6.6.0/bin/logstash -f /usr/local/logstash-6.6.0/config/logstash.conf

9.      后台启动:nohup /usr/local/logstash-6.6.0/bin/logstash -f /usr/local/logstash-6.6.0/config/logstash.conf >/tmp/logstash.log 2>/tmp/logstash.log &

10.   测试标准输入和输出

 

输入:xiaoxiaoyifeng

输出:{

       "message" => "xiaoxiaoyifeng",

          "host" => "xiaoxiaoyifeng51",

    "@timestamp" => 2019-02-24T09:24:51.921Z,

      "@version" => "1"

}

 

Logstash读取日志/usr/local/logstash-6.6.0/config/logstash.conf

input {

  file {

    path => "/var/log/secure"

  }

}

output{

  stdout{

    codec=>rubydebug

  }

}


guiyun affiliate

作者头像
南宫俊逸创始人

君子好学,自强不息~

上一篇:CentOS 7 Elasticsearch的基本操作
下一篇:Zabbix功能概述及架构介绍(理论篇)

发表评论