能够单行格式化Java异常日志

时间:2018-10-11 09:47:48

标签: fluentd google-cloud-stackdriver

我在GCP中部署了一个Java应用程序。  将该日志文件指向使用fluentd的Stackdriver日志记录。

Java exception log用单独的行格式化。因此,Stackdriver Logging无法将其捕获为error / warning。

我需要在一行中格式化Java应用程序异常跟踪。 需要区分信息,错误,警告。

我的流利配置:

<source>
  type tail
  format none
  path /home/app/*-local-app-output.log
  pos_file /var/lib/google-fluentd/pos/local-app.pos
  read_from_head true
  tag local-app
</source>

也尝试过

  format multiline
  format_firstline /\d{4}-\d{1,2}-\d{1,2}/
  format1 /^(?<time>\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}) \[(?<thread>.*)\] (?<level>[^\s]+)(?<message>.*)/
  time_format %b %d %H:%M:%S

当前显示输出: enter image description here

在Kubernetes引擎中部署相同的应用程序时,它具有单独的日志类别字段,如:info,warn,error,critical。

有人可以帮我吗?

0 个答案:

没有答案
相关问题