简体   繁体   English

Logstash:拆分输出

[英]Logstash: splitted output

Is it possible to split output in the Logstash configuration? 是否可以在Logstash配置中拆分输出? for example: I have input: logs: file1.log and file2.log wanted output: 例如:我有输入:日志:file1.log和file2.log想要的输出:

  1. redis-- easy to configure using docs.. redis-易于使用文档进行配置

  2. %MyBigStorage%\\archive\\file1.log for file1.log content only 仅适用于file1.log内容的%MyBigStorage%\\ archive \\ file1.log

  3. %MyBigStorage%\\archive\\file2.log for file2.log content only %MyBigStorage%\\ archive \\ file2.log仅用于file2.log内容

and 1 more thing: is it possible configure it for folders? 还有1件事:是否可以为文件夹配置它?

Yes, you can split the output. 是的,您可以拆分输出。 Also, you can split the output by folder. 另外,您可以按文件夹拆分输出。

First, when you input the logs, you can define the type for each input. 首先,当您输入日志时,可以定义每个输入的类型。

input {
    file {
        path => "/path/to/first/folder/*"  # The * is tell logstash input all the log file in this directory
        type => "file1.log"
    }
    file {
        path => "/path/to/second/folder/*"  
        type => "file2.log"
    }
}

output {
    if [type] == "file1.log" {
         # output to XXX
    } else if [type] == "file2.log" {
         # output to YYY
    }
}

Hope this can help you. 希望这可以帮到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM