@SET buffers_dir=/var/lib/google-cloud-ops-agent/fluent-bit/buffers
@SET logs_dir=/var/log/google-cloud-ops-agent

[SERVICE]
    Daemon                    off
    Flush                     1
    Log_Level                 info
    dns.resolver              legacy
    storage.backlog.mem_limit 50M
    storage.checksum          off
    storage.max_chunks_up     128
    storage.metrics           on
    storage.sync              normal

[INPUT]
    Name            fluentbit_metrics
    Scrape_Interval 60
    Scrape_On_Start True

[INPUT]
    Buffer_Chunk_Size 512k
    Buffer_Max_Size   2M
    DB                ${buffers_dir}/default_pipeline_syslog
    DB.locking        true
    Key               message
    Mem_Buf_Limit     10M
    Name              tail
    Path              /var/log/messages,/var/log/syslog
    Read_from_Head    True
    Rotate_Wait       30
    Skip_Long_Lines   On
    Tag               default_pipeline.syslog
    storage.type      filesystem

[INPUT]
    Dummy         {"code": "LogPingOpsAgent", "severity": "DEBUG"}
    Interval_NSec 0
    Interval_Sec  600
    Name          dummy
    Tag           ops-agent-health

[INPUT]
    Buffer_Chunk_Size 512k
    Buffer_Max_Size   2M
    DB                ${buffers_dir}/ops-agent-fluent-bit
    DB.locking        true
    Key               message
    Mem_Buf_Limit     10M
    Name              tail
    Path              ${logs_dir}/subagents/logging-module.log
    Read_from_Head    True
    Rotate_Wait       30
    Skip_Long_Lines   On
    Tag               ops-agent-fluent-bit
    storage.type      memory

[INPUT]
    Buffer_Chunk_Size 512k
    Buffer_Max_Size   2M
    DB                ${buffers_dir}/ops-agent-health
    DB.locking        true
    Key               message
    Mem_Buf_Limit     10M
    Name              tail
    Path              ${logs_dir}/health-checks.log
    Read_from_Head    True
    Rotate_Wait       30
    Skip_Long_Lines   On
    Tag               ops-agent-health
    storage.type      memory

[FILTER]
    Match  default_pipeline.syslog
    Name   lua
    call   process
    script a0838b96a85b444271af73a8b4b3aa7e.lua

[FILTER]
    Match  ops-agent-fluent-bit
    Name   lua
    call   parser_nest
    script b4a0dead382dce7b4fe011d3f59fdb6d.lua

[FILTER]
    Key_Name     message
    Match        ops-agent-fluent-bit
    Name         parser
    Preserve_Key True
    Reserve_Data True
    Parser       ops-agent-fluent-bit.fluent-bit-self-log-regex-parsing

[FILTER]
    Match  ops-agent-fluent-bit
    Name   lua
    call   parser_merge_record
    script 5fc5f42c16c9e1ab8292e3d42f74f3be.lua

[FILTER]
    Match  ops-agent-health
    Name   lua
    call   parser_nest
    script b4a0dead382dce7b4fe011d3f59fdb6d.lua

[FILTER]
    Key_Name     message
    Match        ops-agent-health
    Name         parser
    Reserve_Data True
    Parser       ops-agent-health.health-checks-json

[FILTER]
    Match  ops-agent-health
    Name   lua
    call   parser_merge_record
    script 5fc5f42c16c9e1ab8292e3d42f74f3be.lua

[FILTER]
    Match ops-agent-health
    Name  grep
    Regex severity INFO|ERROR|WARNING|DEBUG|info|error|warning|debug

[FILTER]
    Match ops-agent-fluent-bit
    Name  rewrite_tag
    Rule  message \[error\]\s\[lib\]\sbackend\sfailed ops-agent-health true

[FILTER]
    Name      modify
    Match     ops-agent-health
    Condition Key_value_matches message \[error\]\s\[lib\]\sbackend\sfailed
    Set       code LogPipelineErr
    Set       message "[Runtime Check] Result: FAIL, Error code: LogPipelineErr, Failure: Ops Agent logging pipeline failed, Solution: Refer to provided documentation link., Resource: https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/troubleshoot-find-info"

[FILTER]
    Match ops-agent-fluent-bit
    Name  rewrite_tag
    Rule  message \[error\]\s\[parser\]\scannot\sparse ops-agent-health true

[FILTER]
    Name      modify
    Match     ops-agent-health
    Condition Key_value_matches message \[error\]\s\[parser\]\scannot\sparse
    Set       code LogParseErr
    Set       message "[Runtime Check] Result: WARNING, Error code: LogParseErr, Failure: Ops Agent failed to parse logs, Solution: Refer to provided documentation link., Resource: https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/troubleshoot-find-info"

[FILTER]
    Match  ops-agent-health
    Name   lua
    call   process
    script 12e2aa0dceffdb500ad72c55dd7ae744.lua

[FILTER]
    Match  ops-agent-*
    Name   lua
    call   process
    script 4d6012ff003886818fb9b9285b4af962.lua

[OUTPUT]
    Match_Regex                   ^(default_pipeline\.syslog)$
    Name                          stackdriver
    Retry_Limit                   3
    http_request_key              logging.googleapis.com/httpRequest
    net.connect_timeout_log_error False
    resource                      gce_instance
    stackdriver_agent             Google-Cloud-Ops-Agent-Logging/2.63.0 (BuildDistro=noble;Platform=linux;ShortName=ubuntu;ShortVersion=24.04)
    storage.total_limit_size      2G
    tls                           On
    tls.verify                    Off
    workers                       8

[OUTPUT]
    Match_Regex                   ^(ops-agent-health|ops-agent-fluent-bit)$
    Name                          stackdriver
    Retry_Limit                   3
    http_request_key              logging.googleapis.com/httpRequest
    net.connect_timeout_log_error False
    resource                      gce_instance
    stackdriver_agent             Google-Cloud-Ops-Agent-Logging/2.63.0 (BuildDistro=noble;Platform=linux;ShortName=ubuntu;ShortVersion=24.04)
    tls                           On
    tls.verify                    Off
    workers                       8

[OUTPUT]
    Match *
    Name  prometheus_exporter
    host  0.0.0.0
    port  20202

