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

GCP Ops agent add static field


I'm trying to add a static value field to the ops agent without success. This is the processor I'm using:

modify_fields:
  type: modify_fields
  fields:
    env:
      static_value: somenv

Also tried:

modify_fields:
  type: modify_fields
  fields:
    env:
      default_value: somenv

I just need all the documents sent by that machine to have a "env" field with value "someenv"

The error I'm getting is "env field not found"

Thank you


Solution

  • The issue was this feature was not available in the version I was using (2.16), so I upgraded to 2.18 and now works.

    Also, need to follow the LogEntry structure

    modify_fields:
      type: modify_fields
      fields:
        jsonPayload.env:
          static_value: somenv
    

    Also record_log_file_path property which wasn't working is working now.