无法使用绝对路径在 logstash 中侦听文件
Cannot listen file in logstash with absolute path
我在路径上安装了 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
}
}
有什么想法吗?
使用正斜杠代替反斜杠。
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
}
}
我在路径上安装了 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
}
}
有什么想法吗?
使用正斜杠代替反斜杠。
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
}
}