Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
<img src="//i.stack.imgur.com/RUiNP.png" height="16" width="18" alt="" class="sponsor tag img">elasticsearch filebeat是否可以将日志行输出转换为json,而不在管道中存储日志?_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Logging_Filebeat - Fatal编程技术网 elasticsearch filebeat是否可以将日志行输出转换为json,而不在管道中存储日志?,elasticsearch,logging,filebeat,elasticsearch,Logging,Filebeat" /> elasticsearch filebeat是否可以将日志行输出转换为json,而不在管道中存储日志?,elasticsearch,logging,filebeat,elasticsearch,Logging,Filebeat" />

elasticsearch filebeat是否可以将日志行输出转换为json,而不在管道中存储日志?

elasticsearch filebeat是否可以将日志行输出转换为json,而不在管道中存储日志?,elasticsearch,logging,filebeat,elasticsearch,Logging,Filebeat,我们在SpringBootWeb应用程序中有标准的日志行(非json)。 我们需要集中日志记录,并将它们作为json发送到弹性搜索 (我听说以后的版本可以做一些转换) Filebeat可以读取日志行并将其包装为json吗?我想它也可以附加一些元数据。不需要解析日志行 预期产出: {timestamp:,beat:,message:“日志行…”} 不幸的是,我没有代码可显示。filebeat支持包括 配置文件filebeat.yml可以如下所示: #文件节拍选项:https://www.elast

我们在SpringBootWeb应用程序中有标准的日志行(非json)。 我们需要集中日志记录,并将它们作为json发送到弹性搜索

(我听说以后的版本可以做一些转换)

Filebeat可以读取日志行并将其包装为json吗?我想它也可以附加一些元数据。不需要解析日志行

预期产出:
{timestamp:,beat:,message:“日志行…”}

不幸的是,我没有代码可显示。

filebeat支持包括

配置文件filebeat.yml可以如下所示:

#文件节拍选项:https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-reference-yml.html
filebeat.inputs:
-类型:原木
已启用:true
路径:
-/var/log/。/file.err.log
处理器:
-下拉列表字段:
#防止日志存储失败(https://www.elastic.co/guide/en/beats/libbeat/current/breaking-changes-6.3.html#custom-模板(无版本索引)
字段:[“主机”]
-剖析:
#标记器语法:https://www.elastic.co/guide/en/logstash/current/plugins-filters-dissect.html.
标记器:“%{}%{}[%{}]{%{}}%{message}”
字段:“消息”
目标前缀:“spring boot”
领域:
日志类型:spring\u引导
output.elasticsearch:
主持人:[”https://localhost:9200"]
用户名:“filebeat_内部”
密码:“您的密码”

默认情况下,它似乎可以做到这一点。这是我在本地尝试读取日志行时得到的结果。它完全像我想要的那样包装它

{  
   "@timestamp":"2019-06-12T11:11:49.094Z",
   "@metadata":{  
      "beat":"filebeat",
      "type":"doc",
      "version":"6.2.4"
   },
   "message":"the log line...",
   "source":"/Users/myusername/tmp/hej.log",
   "offset":721,
   "prospector":{  
      "type":"log"
   },
   "beat":{  
      "name":"my-macbook.local",
      "hostname":"my-macbook.local",
      "version":"6.2.4"
   }
}

谢谢你的回答!我们可能会先将其发送到kafka,然后配置会几乎相同吗?kafka输出也受支持-只需查看文档()谢谢,我检查了文档,但问题是kafka/elastic之前的json转换。它们都需要json;正如我所理解的那样,卡夫卡使用了输出。你能检查一下并通知测试结果吗?