gpt4 book ai didi

elasticsearch - 拖尾json文件时流利的模式不匹配错误

转载 作者:行者123 更新时间:2023-12-02 22:36:36 25 4
gpt4 key购买 nike

我已经安装了fluentd logger,并且希望它监视我的python代码的日志。日志是json日志,如下所示:

{
"FileNo": 232,
"FileClass": "timitry",
"FileLevel": "24",
"DataCount": 5,
"Data": {
"User1": <Username>,
"User2": <Username>,
"User3": <Username>,
"User4": <Username>,
"User5": <Username>"
},
"time": "2018-05-14T05:33:02.071793"
}

这每5分钟更新一次。我需要为其编写一个流利的输入插件,以便它可以读取新的json数据并将其发布到 elastic search。我真的不知道在这里使用哪个输入插件,但是我使用了 tail,它给了我以下错误:
2018-05-14 05:31:04 +0000 [warn]: #0 pattern not match: "    \"FileClass\": \"timitry\","

所有数据都相同。谁能建议我如何解决这个问题。下面是配置文件:
<source>
@type tail
format json
path /home/user/Documents/logs/file_log.json
tag first
</source>

<match first*>
@type elasticsearch
hosts 192.168.111.456:9200
user <username>
password <password>
</match>

我看到其他人使用 regex和其他格式。我还需要使用它吗?如何使用python代码生成的日志以供fluentd使用并将其发布到 elastic search

谢谢

最佳答案

您是否可以尝试在match指令中的第一个之后删除通配符?
喜欢 :

<match first>
@type elasticsearch
hosts 192.168.111.456:9200
user <username>
password <password>
</match>

关于elasticsearch - 拖尾json文件时流利的模式不匹配错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50323674/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com