json - fluentd 中的 JSON 解析错误,总是抛出不匹配的模式
问题描述
我正在尝试向我的 fluentd 添加一个新源来解析 JSON 文件。JSON 文件如下所示
{
"local": {
"cmd_|-start_cmd_2_|-echo 'Starting to run second time'_|-run": {
"comment": "Command \"echo 'Starting to run second time'\" run",
"name": "echo 'Starting to run second time'",
"result": true,
"duration": 11.144,
"__sls__": "test",
"changes": {
"pid": 26010,
"retcode": 0,
"stderr": "",
"stdout": "Starting to run second time"
},
"__id__": "start_cmd_2"
},
}
}
这是盐栈执行的 JSON 输出。我已经添加了这个来源
<source>
@type tail
tag salt-new
path /var/log/salt_new.json
pos_file /tmp/fluentd/new.pos
<parse>
@type json
</parse>
refresh_interval 10s
</source>
我尝试了一些变体,例如使用“格式 json”,但它不起作用。它总是抛出
2020-03-19 18:05:13 +0000 [info]: #0 following tail of /var/log/salt_new.json
2020-03-19 18:05:13 +0000 [warn]: #0 pattern not matched: "{"
2020-03-19 18:05:13 +0000 [warn]: #0 pattern not matched: " \"local\": {"
2020-03-19 18:05:13 +0000 [warn]: #0 pattern not matched: " \"cmd_|-start_cmd_2_|-echo 'Starting to run second time'_|-run\": {"
.
.
我不想使用正则表达式解析,我正在尝试让 JSON 解析器插件工作。
任何建议都会非常有帮助。谢谢
解决方案
推荐阅读
- r - 在 R 中使用 auto.arima 显示初始数据的预测值
- vb.net - DirectoryServices - 查找域中的所有 Windows 7 和 Windows 10 计算机
- mysql - 什么将是 sql 查询以打印具有相同 id 表的多个表中的所有行?
- java - 设置 textview 会使应用程序崩溃
- python-3.x - 索引一组批处理图像
- python - Tesseract 没有在 Mac OSX 上的 python 上正确安装
- ios - 删除收藏单元格
- sqlite - 为什么我无法在 ubuntu 18.04 中启动 sqlite 浏览器?
- c - 在 C 中打印字符数组
- python - Django 传递字符串参数