0

我在路径上安装了 logstash:D:\WORK\ElasticSearch\logstash-2.0.0\bin,我的应用程序在路径上写入日志:D:\Logs

当我使用 logstash 路径通过此脚本加载日志“D:\WORK\ElasticSearch\logstash-2.0.0\bin”时,我能够阅读它。 input { file { path => ["\PlatformTest_*"] #discover_interval - How often (in seconds) we expand the filename patterns in the path option to discover new files to watch discover_interval => 20 #start_position - Choose where Logstash starts initially reading files: at the beginning or at the end start_position => "beginning" #stat_interval - How often (in seconds) we stat files to see if they have been modified. stat_interval => 2 } }

但是当我使用这个日志的真实路径时,它不起作用: input { file { path => ["D:\Logs\PlatformTest_*"] #discover_interval - How often (in seconds) we expand the filename patterns in the path option to discover new files to watch discover_interval => 20 #start_position - Choose where Logstash starts initially reading files: at the beginning or at the end start_position => "beginning" #stat_interval - How often (in seconds) we stat files to see if they have been modified. stat_interval => 2 } }

另外,当我尝试相对路径时,它也不起作用: input { file { path => ["\..\..\..\..\Logs\PlatformTest_*"] #discover_interval - How often (in seconds) we expand the filename patterns in the path option to discover new files to watch discover_interval => 20 #start_position - Choose where Logstash starts initially reading files: at the beginning or at the end start_position => "beginning" #stat_interval - How often (in seconds) we stat files to see if they have been modified. stat_interval => 2 } }

任何想法?

4

1 回答 1

0

使用正斜杠而不是反斜杠。

input 
{
    file 
    {
        path => ["D:/Logs/PlatformTest_*"]
        #discover_interval - How often (in seconds) we expand the filename patterns in the path option to discover new files to watch
        discover_interval => 20
        #start_position - Choose where Logstash starts initially reading files: at the beginning or at the end
        start_position => "beginning"
        #stat_interval - How often (in seconds) we stat files to see if they have been modified. 
        stat_interval => 2
    }
}
于 2015-11-24T12:39:59.590 回答