How to get messages with line break google-cloud-ops-agent to recognize it with a single message

741 views Asked by At

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)"
1

There are 1 answers

1
Ian Marcinkowski On

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