如何获取带有换行符的消息 google-cloud-ops-agent 以通过单个消息识别它

发布于 2025-01-17 17:13:28 字数 1442 浏览 0 评论 0原文

我正在尝试配置 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柠北森屋 2025-01-24 17:13:28

就您而言,看起来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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文