一、下载地址

官网:https://www.elastic.co/cn/downloads/logstash

百度云盘:

二、安装

tar zxvf logstash-6.2..tar.gz
mv logstash-6.2. logstash

配置文件(配置文件放哪个目录都可以,在启动Logstash时可以指定配置文件位置)

vi k_es.conf
input{
kafka {
bootstrap_servers => "10.10.6.225:9092" #kafka服务器地址,不是zookeeper
client_id => "test"
auto_offset_reset => "latest"
consumer_threads =>
decorate_events => true
topics => ["test"] #控制kafka哪个topic,可以多个用逗号分割
codec => "json"
}
}
filter{
json {
source => "message"
remove_field=>["message","beat","@version"] #删除没用的属性
add_field =>["customize","自定义字段"] #增加属性
}
}
output {
elasticsearch {
hosts => "localhost:9200"
index => "logstash-nginxacclog-%{+YYYY.MM.dd}" #放到elasticsearch哪个index中
}
}

启动(到bin目录下)

./logstash -f k_es.conf

后台运行

nohup /usr/local/logstash/bin/logstash -f /usr/local/logstash/bin/k_es.conf -w 8 -b 1000 > /dev/null 2>&1 &

配置文件备份

input{
kafka {
bootstrap_servers => "10.100.2.210:9092"
client_id => "nginxaccesslog"
auto_offset_reset => "latest"
consumer_threads =>
decorate_events => true
topics => ["nginx_access_log"]
codec => "json"
type => "nginx_log"
}
kafka {
bootstrap_servers => "10.100.2.210:9092"
client_id => "database"
auto_offset_reset => "latest"
consumer_threads =>
decorate_events => true
topics => ["t_resource_info","t_base_person","t_base_organization","t_base_student","t_base_parent","t_base_class"]
codec => "json"
type => "dsideal_db"
}
kafka {
bootstrap_servers => "10.100.2.210:9092"
client_id => "devops_real"
auto_offset_reset => "latest"
consumer_threads =>
decorate_events => true
topics => ["devopsrealinfo"]
codec => "json"
type => "devopsrealinfo"
}
kafka {
bootstrap_servers => "10.100.2.210:9092"
client_id => "devops_base"
auto_offset_reset => "latest"
consumer_threads =>
decorate_events => true
topics => ["devopsbaseinfo"]
codec => "json"
type => "devopsbaseinfo"
}
}
filter{
mutate {
gsub => ["message", "\\x22", '"']
}
json {
source => "message"
remove_field=>["message","beat","@version"]
}
if [type] == "nginx_log" {
geoip {
source => "ip"
target => "geoip"
database => "/usr/local/GeoLite2-City.mmdb"
}
}
}
output {
if [type] == "nginx_log" {
elasticsearch {
hosts => "10.100.2.210:9200"
index => "nginx-access-log"
}
}
if [type] == "dsideal_db" {
elasticsearch {
hosts => "10.100.2.210:9200"
index => "%{table_name}"
document_id => "%{id}"
}
}
if [type] == "devopsbaseinfo" {
elasticsearch {
hosts => "localhost:9200"
index => "devopsbaseinfo"
document_id => "%{id}"
}
}
if [type] == "devopsrealinfo" {
elasticsearch {
hosts => "localhost:9200"
index => "devopsrealinfo"
}
}
}

CentOS6.9安装Logstash的更多相关文章

  1. CentOS6.5安装elasticsearch+logstash+kibana

    首先卸载低版本的java环境,然后安装 java环境和Apache服务 yum install -y java--openjdk httpd 安装ES环境 elasticsearch wget htt ...

  2. 安装logstash及logstash的初步使用-处理DNS日志

    安装logstash 需要高版本的java 使用1.4版本的java会有报错 # Can't start up: not enough memory 查询java信息 rpm -qa | grep j ...

  3. vmware Centos6.6安装64位

    Centos6.6安装64位 必须开启BIOS中的虚拟化技术 首先开机进入BIOS,一般机器是按F2,我的T420是按F1,然后进入Security,Virtualization,选择Enable即可 ...

  4. Gitlab完美安装【CentOS6.5安装gitlab-6.9.2】

    摘要: 拆腾了几天,终于在今天找到了快速安装Gitlab的方法.CentOS6.5安装gitlab-6.9.2 参考网址:https://gitlab.com/gitlab-org/omnibus-g ...

  5. CentOS6.5安装Tomcat

    安装说明 安装环境:CentOS-6.4 安装方式:源码安装 软件:apache-tomcat-7.0.56.tar.gz 下载地址:http://tomcat.apache.org/download ...

  6. Centos6 yum安装openldap+phpldapadmin+TLS+双主配置

    原文地址:http://54im.com/openldap/centos-6-yum-install-openldap-phpldapadmin-tls-%E5%8F%8C%E4%B8%BB%E9%8 ...

  7. centos6.5安装oracle11g_2

    centos7安装oracle数据库不成功,换成centos6.5安装,可以安装成功,记录一下 安装系统时,主机名如果不是用localhost,安装成功后,要用主机名和ip做映射,修改/etc/hos ...

  8. CentOS6.6安装vmware workstation报错

    本人系统用的是centos6.6,安装了vmware workstation,启动后一直如下图报错,相关内核已经安装了的,哪位前辈如果解决过这样的问题,麻烦指点指点,小弟在此先谢过了.

  9. CentOS6.6安装virtualbox4.1.44

    本人用的是centos6.6,安装了virtualbox 4.1.44,启动后一直如上图报错,哪位前辈如果解决过这样的问题,麻烦指点指点,小弟在此先谢过了.

随机推荐

  1. 查看局域网中连接的主机名和对应的IP地址

    1.查看局域网中的所有主机名 2.通过主机名解析IP地址:-4选项 3.通过IP地址解析主机名:-a选项

  2. UVALive 8519 Arrangement for Contests 2017西安区域赛H 贪心+线段树优化

    题意 等价于给一个数列,每次对一个长度为$K$的连续区间减一 为最多操作多少次 题解: 看样例猜的贪心,10分钟敲了个线段树就交了... 从1开始,找$[i,i+K]$区间的最小值,然后区间减去最小值 ...

  3. CSS3 Hover 动画特效

    根据 奇舞团:http://www.75team.com/archives/807 做的demo 根据视频中跟着做的 demo1: <!DOCTYPE html> <html lan ...

  4. CURL错误代码及含义

    https://curl.haxx.se/libcurl/c/libcurl-errors.html NAME libcurl-errors - error codes in libcurl DESC ...

  5. zipkin 整合elastic

    前提: <dependency> <groupId>io.zipkin.java</groupId> <artifactId>zipkin</ar ...

  6. 19)django-cookie使用

    Cookie,有时也用其复数形式 Cookies,指某些网站为了辨别用户身份.进行 session 跟踪而储存在用户本地终端上的数据(通常经过加密) 一:cookie cookie在客户端浏览器的是以 ...

  7. 微信小程序UI组件--Lin UI

    地址:http://doc.mini.7yue.pro/ Lin UI 是基于 微信小程序原生语法 实现的组件库

  8. Confluence 6 找到在创建 XML 备份的时候出现的错误

    错误可能是因为数据库突然不可访问而产生.如果你在你的日志中看到了错误  'Couldn't backup database data' ,这个指南将会帮助你更正这个错误.我们强烈推荐你备份 Confl ...

  9. nginx之访问控制http_access_module与http_auth_basic_module

    http_access_module 作用 基于IP的访问控制 语法 使用 局限性 解决办法 1. http_x_forwarded_for http_auth_basic_module 作用 基于用 ...

  10. 《剑指offer》 反转链表

    本题来自<剑指offer> 反转链表 题目: 输入一个链表,反转链表后,输出新链表的表头. 思路: 需要三个变量,来保存当前节点的,前面节点和反转后的节点. C++ Code: /* st ...