zoukankan      html  css  js  c++  java
  • logstash 运行

    logstash启动和配置

    logstash linux下启动如下

    (守护进程)

    ./bin/logstash agent -f conf/paycenter.conf &

    logstash配置

    测试服务器的写法:

    业务日志文件格式如果是按天分隔:

    gwp.eyimi.com_80_access_2017-07-18.log
    gwp.eyimi.com_80_access_2017-07-19.log
    gwp.eyimi.com_80_access_2017-07-19.log

    那么在input里面使用日期格式

    /data/other/nginxlogs/gwp.eyimi.com_80_access%{+YYYY.MM.dd}.log

    如果是只有一个文件格式,直接使用文件的绝对路径即可!

    input {
         file {
            path => "/data/other/nginx_logs/gwp.eyimi.com_80_access_%{+YYYY.MM.dd}.log"
            codec => "json"
            type => "zuolinyoujia"
        }
        //可以写多个文件,不过多个文件最终的type必须统一为一个!!!
    //  file {
    //        path => "/data/other/nginx_logs/nginx_error.log"
      //      codec => "json"
     //       type => "zuolinyoujia"
     //   }
    }
    output {
          redis {
                    batch_count => 10
                    data_type => "list"
                    host => "10.0.9.43"
                    port => 4501
                    key => "%{type}"
                    password => "chngalaxy2017!!!" #如果有安全认证,此项为密码
                    codec => "json"
            threads => 2
        }
        }
    }
    

      

    正式服务器的写法

    (正式服务器的机器资源在申请,先内网测试走通一下看看)

    input {
         file {
            path => "/data/other/nginx_logs/gwp.eyimi.com_80_access.log"
            codec => "json"
            type => "zuolinyoujia"
        }
      file {
            path => "/data/other/nginx_logs/nginx_error.log"
            codec => "json"
            type => "zuolinyoujia"
        }
    }
    output {
          redis {
                    batch_count => 10
                    data_type => "list"
                    host => "192.168.0.75"
                    port => 4501
                    key => "%{type}"
                    password => "chngalaxylog2017good!!!" #如果有安全认证,此项为密码
                    codec => "json"
            threads => 2
        }
        }
    }
    

      

  • 相关阅读:
    [gym102832J]Abstract Painting
    [atARC070E]NarrowRectangles
    [atARC070F]HonestOrUnkind
    Cupid's Arrow[HDU1756]
    Surround the Trees[HDU1392]
    TensorFlow-正弦函数拟合
    某新版本不兼容老版本代码的语言的一点基础了解
    TensorFlow安装
    离散快速傅里叶变换
    2016"百度之星"
  • 原文地址:https://www.cnblogs.com/akidongzi/p/7815181.html
Copyright © 2011-2022 走看看