Logstash无法读取文件 [英] Logstash can't read file

查看:104
本文介绍了Logstash无法读取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次使用Logstash.我在Windows 10上我尝试从这样的input/文件夹访问多行json文件:

I'm using Logstash for the first time. I'm on Windows 10 I try to access a multiline json file from a input/ folder like this :

input 
{   
    file 
    {
        codec => multiline
        {
            pattern => '^/{'
            negate => true
            what => previous                
        }
        path => "/input/*.json"
        exclude => "*.gz"
    }
}

filter 
{
    mutate
    {
        replace => [ "message", "%{message}" ]
        gsub => [ 'message','\n','']
    }
    if [message] =~ /^{.*}$/ 
    {
        json { source => message }
    }

}

output
{
    file
    {
        path => "/output/output.json"
    }
}

这里的问题是,当我启动logstash实例时,出现此错误:

The problem here is when i'm launching logstash instance I get this error :

警告 logstash.inputs.file - 无法打开/input/sample.json:\ input \ sample.json

WARN logstash.inputs.file - failed to open /input/sample.json: \input\sample.json

我已经在startup.options 中用adm 替换了LS_GROUP 并尝试用\"替换/",但没有成功.我也"chmod 777"我的json文件,但它什么也没改变.

I already replace the LS_GROUP by adm in startup.options and tried to replace "/" with "\", didn't work. I also "chmod 777" my json file but it change nothing.

有什么主意吗?

推荐答案

使用/应该可以正常工作.如果您尝试使用这样的 \\ 来转义 path 怎么办:

Going with / should work fine. What if you're trying to have the path something like this, escaping with \\:

path => "\\input\\*.json"

确保提供完整的路径.

这篇关于Logstash无法读取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆