0x00 概述

需求:需要利用同一logstash进程采集不同日志,输出到es的不同index,各输入输出隔离;

主要需要解决如下两个问题:

0x01 如何加载多个配置文件

普通启动方式:

nohup bin/logstash -f config/logstash.conf &

多配置文件启动方式:

nohup bin/logstash -f config/java-conf &

注意:java-conf为目录,将加载该目录下所有配置文件;不要使用config/java-conf/*.conf

问题:配置不当,各输入输出会存在交叉,解决办法参考以下第二点。

0x02 如何隔离各输入输出

利用type,对输入输出进行筛选,配置参考:

log1.conf
input {
  file {
    type => "log1" 
    path => "/**/log1.log" 
    discover_interval => 10 # 监听间隔 
    start_position => "beginning" #从头开始
  }
} #输出到elasticsearch 
output {
  if [type] == "log1"{
    elasticsearch {
    index => "log1-%{+YYYY.MM.dd}" 
    hosts => "192.168.2.32:9200"   #输出到elasticsearch 对应服务器
    }
  }
} log2.conf
input {
  file {
    type => "log2" 
    path => "/**/log2.log" 
    discover_interval => 10 # 监听间隔 
    start_position => "beginning" #从头开始
  }
} #输出到elasticsearch 
output {
  if [type] == "log2"{
    elasticsearch {
    index => "log2-%{+YYYY.MM.dd}" 
    hosts => "192.168.2.32:9200"   #输出到elasticsearch 对应服务器
    }
  }
}

PS:index名不能包含大写字母。

ELK学习笔记之logstash配置多入多出并互相隔离的更多相关文章

  1. ELK学习笔记之Logstash和Filebeat解析对java异常堆栈下多行日志配置支持

    0x00 概述 logstash官方最新文档.假设有几十台服务器,每台服务器要监控系统日志syslog.tomcat日志.nginx日志.mysql日志等等,监控OOM.内存低下进程被kill.ngi ...

  2. ELK学习笔记之Logstash详解

    0x00 Logstash概述 官方介绍:Logstash is an open source data collection engine with real-time pipelining cap ...

  3. ELK 学习笔记之 Logstash之output配置

    Logstash之output配置: 输出到file 配置conf: input{ file{ path => "/usr/local/logstash-5.6.1/bin/spark ...

  4. ELK 学习笔记之 Logstash之inputs配置

    Logstash之inputs配置: input plugin doc: https://www.elastic.co/guide/en/logstash/current/index.html 插件很 ...

  5. ELK学习笔记之logstash将配置写在多个文件

    0x00 概述 我们用Logsatsh写配置文件的时候,如果读取的文件太多,匹配的正则过多,会使配置文件动辄成百上千行代码,可能会造成阅读和修改困难.这时候,我们可以将配置文件的输入.过滤.输出分别放 ...

  6. ELK 学习笔记之 Logstash之filter配置

    Logstash之filter: json filter: input{ stdin{ } } filter{ json{ source => "message" } } o ...

  7. ELK 学习笔记之 Logstash之codec配置

    Logstash之codec: Logstash处理流程: input=>decode=>filter=>encode=>output 分类: Plain编码: input{ ...

  8. ELK 学习笔记之 Logstash安装

    Logstash安装: https://www.elastic.co/downloads/logstash 下载解压: tar –zxvf logstash-5.6.1.tar.gz 在/usr/lo ...

  9. ELK学习笔记之Logstash不停机自动重载配置文件

    0x00 自动重新加载配置 为了可以自动检测配置文件的变动和自动重新加载配置文件,需要在启动的时候使用以下命令: ./bin/lagstash -f configfile.conf --config. ...

随机推荐

  1. 你向 Mysql 数据库插入 100w 条数据用了多久?

    阅读本文大概需要 2 分钟. ▌目录 多线程插入(单表) 多线程插入(多表) 预处理 SQL 多值插入 SQL 事务( N 条提交一次) ▌多线程插入(单表) 问:为何对同一个表的插入多线程会比单线程 ...

  2. kafka(一)设计分析

    参考文档:Kafka 设计与原理详解:http://blog.csdn.net/suifeng3051/article/details/48053965Kafka深度解析:http://blog.cs ...

  3. window系统对应默认IE浏览器版本

  4. C#-关于TcpListener的AcceptTcpClient()方法造成线程阻塞,进而程序无法彻底关闭的问题

    https://blog.csdn.net/nuistchn/article/details/50809158 在<C#高级编程>第7版第24章,有提到使用TCP类. 书中写了一个实例,两 ...

  5. sumdoc t3 final dir.txt

    C:\Users\zhoufeiyue\Documents\sumdoc t3 final\sumdoc t3 final dir.txtC:\Users\zhoufeiyue\Documents\s ...

  6. config:fail,Error: 系统错误,错误码:63002,invalid signature [20191104 17:18:1

    需要检查下后端有没有缓存到redis.这个很重要不然也会报这个错

  7. [转]怎样与 CORS 和 cookie 打交道

    原文地址:https://segmentfault.com/a/1190000018756960 前言 CORS 与 cookie 在前端是个非常重要的问题,不过在大多数情况下,因为前后端的 doma ...

  8. php-7.3.4 configure: error: Please reinstall the libzip distribution

    php-7.3.4 configure: error: Please reinstall the libzip distribution # wget https://libzip.org/downl ...

  9. 946. Validate Stack Sequences

    946. Validate Stack Sequences class Solution { public: bool validateStackSequences(vector<int> ...

  10. Holmos框架

    一.Holmos介绍--简介 Holmos-webtest是一个居于selenium2.0二次封装的开源框架,采用Page-Object模式去组织页面结构,同时支持多维度的页面元素定位方式,同时还继承 ...