如何获取带有换行符的消息 google-cloud-ops-agent 以通过单个消息识别它
我正在尝试配置 google-cloud-ops-agent 以从应用程序收集日志记录。
我的配置相当高级,但是当日志消息包含多行时,我会遇到问题,例如:
11:18:18,396 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-9) JNDI bindings for session bean named CommonJServiceBinder in deployment unit deployment "jboss-commonj-binder-1.2.jar" are as follows:
java:global/jboss-commonj-binder-1.2/CommonJServiceBinder!com.manh.jboss.commonj.CommonJServiceBinder
java:app/jboss-commonj-binder-1.2/CommonJServiceBinder!com.manh.jboss.commonj.CommonJServiceBinder
java:module/CommonJServiceBinder!com.manh.jboss.commonj.CommonJServiceBinder
java:global/jboss-commonj-binder-1.2/CommonJServiceBinder
java:app/jboss-commonj-binder-1.2/CommonJServiceBinder
java:module/CommonJServiceBinder
在这些情况下,日志浏览器将每一行显示为单独的消息。 记录浏览器
我的配置如下:
logging:
receivers:
AS_CA:
type: files
include_paths:
- /home/log/server-startup.log
service:
pipelines:
custom_pipeline_CA:
receivers: [AS_CA]
processors: [TYPE1]
processors:
TYPE1:
type: parse_regex
field: message
regex: "^(?<time>^[0-9]{2}:[0-9]{2}:[0-9]{2}\,[0-9]{3})\s+(?<severity>DEFAULT|DEBUG|INFO|NOTICE|WARNING|WARN|ERROR|CRITICAL|ALERT|EMERGENCY)\s+(?<msg>.*\n)"
I am trying to configure google-cloud-ops-agent to collect log records from an application.
I have the configuration pretty advanced, but I have problems when the log message contains more than one line, for example:
11:18:18,396 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-9) JNDI bindings for session bean named CommonJServiceBinder in deployment unit deployment "jboss-commonj-binder-1.2.jar" are as follows:
java:global/jboss-commonj-binder-1.2/CommonJServiceBinder!com.manh.jboss.commonj.CommonJServiceBinder
java:app/jboss-commonj-binder-1.2/CommonJServiceBinder!com.manh.jboss.commonj.CommonJServiceBinder
java:module/CommonJServiceBinder!com.manh.jboss.commonj.CommonJServiceBinder
java:global/jboss-commonj-binder-1.2/CommonJServiceBinder
java:app/jboss-commonj-binder-1.2/CommonJServiceBinder
java:module/CommonJServiceBinder
In these cases, the log browser displays each line as a separate message.
Record Browser
The configuration I have is as follows:
logging:
receivers:
AS_CA:
type: files
include_paths:
- /home/log/server-startup.log
service:
pipelines:
custom_pipeline_CA:
receivers: [AS_CA]
processors: [TYPE1]
processors:
TYPE1:
type: parse_regex
field: message
regex: "^(?<time>^[0-9]{2}:[0-9]{2}:[0-9]{2}\,[0-9]{3})\s+(?<severity>DEFAULT|DEBUG|INFO|NOTICE|WARNING|WARN|ERROR|CRITICAL|ALERT|EMERGENCY)\s+(?<msg>.*\n)"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
就您而言,看起来
parse_multiline
处理器可能会起作用。它支持默认的Java记录线。https> https:// cloud。 google.com/stackdriver/docs/solutions/agents/ops-agent/configuration#logging-processor-parse-multiline
In your case, it looks like the
parse_multiline
processor might work. It has support for default Java logging lines.https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/configuration#logging-processor-parse-multiline