<source>
  @type tail
  format json
  time_key "#{ENV['TIME_KEY']}"
  path "#{ENV['CONTAINER_LOGS_PATH']}"
  exclude_path "#{ENV['EXCLUDE_PATH']}"
  pos_file /mnt/pos/ggcp-containers.log.pos
  time_format %Y-%m-%dT%H:%M:%S.%NZ
  tag containers.*
  read_from_head "#{ENV['READ_FROM_HEAD']}"
  enable_stat_watcher "#{ENV['ENABLE_STAT_WATCHER']}"
</source>
<filter containers.**>
  @type kubernetes_metadata
  @log_level warn
  annotation_match ["sumologic\.com.*"]
  de_dot false
  watch "#{ENV['K8S_METADATA_FILTER_WATCH']}"
  ca_file "#{ENV['K8S_METADATA_FILTER_CA_FILE']}"
  verify_ssl "#{ENV['K8S_METADATA_FILTER_VERIFY_SSL']}"
  client_cert "#{ENV['K8S_METADATA_FILTER_CLIENT_CERT']}"
  client_key "#{ENV['K8S_METADATA_FILTER_CLIENT_KEY']}"
  bearer_token_file "#{ENV['K8S_METADATA_FILTER_BEARER_TOKEN_FILE']}"
  cache_size "#{ENV['K8S_METADATA_FILTER_BEARER_CACHE_SIZE']}"
  cache_ttl "#{ENV['K8S_METADATA_FILTER_BEARER_CACHE_TTL']}"
  tag_to_kubernetes_name_regexp '.+?\.containers\.(?<pod_name>[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)_(?<namespace>[^_]+)_(?<container_name>.+)-(?<docker_id>[a-z0-9]{64})\.log$'
  merge_json_log false
</filter>
<filter containers.**>
  @type kubernetes_sumologic
  source_name "#{ENV['SOURCE_NAME']}"
  source_host "#{ENV['SOURCE_HOST']}"
  log_format "#{ENV['LOG_FORMAT']}"
  kubernetes_meta "#{ENV['KUBERNETES_META']}"
  kubernetes_meta_reduce "#{ENV['KUBERNETES_META_REDUCE']}"
  add_stream "#{ENV['ADD_STREAM']}"
  add_time "#{ENV['ADD_TIME']}"
  source_category "#{ENV['SOURCE_CATEGORY']}"
  source_category_prefix "#{ENV['SOURCE_CATEGORY_PREFIX']}"
  source_category_replace_dash "#{ENV['SOURCE_CATEGORY_REPLACE_DASH']}"
  exclude_namespace_regex "#{ENV['EXCLUDE_NAMESPACE_REGEX']}"
  exclude_pod_regex "#{ENV['EXCLUDE_POD_REGEX']}"
  exclude_container_regex "#{ENV['EXCLUDE_CONTAINER_REGEX']}"
  exclude_host_regex "#{ENV['EXCLUDE_HOST_REGEX']}"
</filter>
