zoukankan      html  css  js  c++  java
  • elk系列5之syslog的模块使用【转】

    preface

    rsyslog是CentOs系统自带的的一个日志工具,那么我们就配置logstash来接受rsyslog的日志。

    logstash的syslog模块

    linux-node2上操作
    logstash采集rsyslog发过来的日志,需要通过syslog模块来接受,这个模块的官网资料是:https://www.elastic.co/guide/en/logstash/2.3/plugins-inputs-syslog.html
    下面我们就动手配置下logstash的配置文件

    [root@linux-node2 ~]# cat /etc/logstash/conf.d/syslog.conf
    input{
        syslog {
            type => "rsyslog"
            port => 514
        }
    }
    filter{
    }
    output{
        elasticsearch {
            hosts => ["192.168.141.4:9200"]
            index => "rsyslog-%{+YYYY.MM}"
        }
    }

    确认无误后,且当前服务器514端口没有被占用,因为logstash使用syslog模块后会占用514端口,所以得确保没有占用的514端口,启动logstash

    [root@linux-node2 conf.d]# /opt/logstash/bin/logstash -f /etc/logstash/conf.d/syslog.conf

    查看514端口是否存在

    [root@linux-node2 ~]# netstat -lnpt |grep 514
    tcp        0      0 :::514                      :::*                        LISTEN      37157/java

    配置rsyslog

    我们切换到另一台服务器上,在linux-node1节点上操作。
    配置rsyslog.conf,把日志输送到远端的logstash上,即linux-node2上的logstash

    [root@linux-node1 ~]# grep 514 /etc/rsyslog.conf |grep -v ^#
    *.* @@192.168.141.4:514

    确认无误后,重新rsyslogd程序。

    [root@linux-node1 ~]# /etc/init.d/rsyslog restart

    查看logstash是否接收到了。

    我们打开head模块地址查看到有我们刚才配置的索引生成。地址是http://192.168.141.3:9200/_plugin/head/
    如下图所示:
    image

    然后切换到kibana上,把system-log添加进去。

    转自

    elk系列5之syslog的模块使用 - 温柔易淡 - 博客园
    http://www.cnblogs.com/liaojiafa/p/6159119.html

  • 相关阅读:
    完全N叉树寻找祖先
    MySql_Front新建数据库遇到访问地址冲突问题
    C++金额的中文大写
    STL_sort cmp
    螺旋数组
    ~
    Struts向JSP中传值
    Struts1-配置文件部分
    jQuery Ajax 的 load()方式
    jquery animate
  • 原文地址:https://www.cnblogs.com/paul8339/p/7357528.html
Copyright © 2011-2022 走看看