无法使用绝对路径

时间:2015-11-24 10:14:09

标签: elasticsearch logstash logstash-file

我在路径上安装了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 } }

任何想法?

1 个答案:

答案 0 :(得分: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
    }
}
相关问题