logging {
  level = "debug"
}

loki.write "default" {
  endpoint {
    url = "http://84.52.100.93:3100/loki/api/v1/push"
  }
}

local.file_match "rest1c_errors" {
  path_targets = [
    {
      __path__ = "/home/bitrix/www/rest1c/errors/*.log",
      job      = "rest1c-errors",
      host     = sys.env("ALLOY_HOST"),
      project  = "rest1c",
    },
  ]
}

local.file_match "rest1c_storage_logs" {
  path_targets = [
    {
      __path__ = "/home/bitrix/www/rest1c/storage/logs/*.log",
      job      = "rest1c-storage",
      host     = sys.env("ALLOY_HOST"),
      project  = "rest1c",
    },
  ]
}

loki.source.file "rest1c_logs" {
  targets = array.concat(
    local.file_match.rest1c_errors.targets,
    local.file_match.rest1c_storage_logs.targets,
  )

  forward_to = [loki.write.default.receiver]
}
