zoukankan      html  css  js  c++  java
  • collectd 与 logstash配置

    节点

    • node1: 配置logstash
    • node2: 配置collectd, collectd收集本地的信息, 通过配置将信息发送到node1节点

    node1安装配置logstash

    • rpm -ivh logstash.rpm
    • logstash安装在/opt目录下, 在/etc/profile,d目录下添加logstash.sh脚本文件将其添加到环境变量中
    • export PATH=$PATH:/opt/logstash/bin
    • 配置文件在/etc/logstash/conf.d下, 默认该目录是空的
    • 示例配置文件

    example 1:

    input {
    file {
    path => "/var/log/messages"
    type => "system"
    start_position => "beginning"
    }
    }

    output {
    stdout {
    codec => rubydebug
    }
    }

    example 2:

    input {
    stdin {}
    }

    output {
    stdout {
    codec => rubydebug
    }
    }

    example 3(此为collectd的配置, 等会就是这个):

    input {
    udp {
    port => 25826
    type => "collectd"
    codec => collectd {}
    }
    }

    output {
    stdout {
    codec => rubydebug
    }
    }

    node2安装配置collectd

    • yum install collectd #collectd在epel源
    • 配置文件为/etc/collectd.conf
    • LoadPlugin network
    • Hostname "node2"
    • systemctl start collectd

    node1使用logstash

    • logstash -f /etc/logstash/collectd.conf --configtest
    • logstash -f /etc/logstash/collectd.conf
  • 相关阅读:
    动手动脑
    原码反码补码
    考试感想
    第八周
    第七周
    第六周
    第五周
    第四周
    Hamburger Magi(hdu 3182)
    Doing Homework(hdu)1074
  • 原文地址:https://www.cnblogs.com/megachen/p/9657609.html
Copyright © 2011-2022 走看看