Search code examples
google-cloud-monitoringgoogle-cloud-ops-agent

creating receivers for logs and pipeline for new receivers


In Google Cloud Ops Agent, an example of MySQL config.yaml is given as:

logging:
  receivers:
    mysql_error:
      type: mysql_error
    mysql_general:
      type: mysql_general
    mysql_slow:
      type: mysql_slow
  service:
    pipelines:
      mysql:
        receivers:
          - mysql_error
          - mysql_general
          - mysql_slow
metrics:
  receivers:
    mysql:
      type: mysql
  service:
    pipelines:
      mysql:
        receivers:
          - mysql

And to ingest logs from MySQL, receivers must be created for MySQL logs and a pipeline created for the new receivers.

How would you go about including:

include_paths

as

"type"

and

/var/log/mysql/mysqld.log

as

"value"?

I've been unable to find a good documentation covering this.

Thanks for the help.


Solution

  • Use file as the type and the path you specified in your post as the value. Below is a sample code for your use case:

    receivers:
      RECEIVER_ID:
        type: files
    
        include_paths: [/var/log/*.log]
        exclude_paths: [/var/log/not-this-one.log]
    

    For more information about this topic you can visit it on the Official GCP documentation.