全部产品
Search
文档中心

Resource Orchestration Service:ALIYUN::SLS::LogtailConfig

更新时间:Jul 06, 2025

ALIYUN::SLS::LogtailConfig digunakan untuk mengonfigurasi properti Logtail guna pengumpulan data.

Sintaks

{
  "Type": "ALIYUN::SLS::LogtailConfig",
  "Properties": {
    "ProjectName": String,
    "LogtailConfigName": String,
    "LogstoreName": String,
    "RawConfigData": Map,
    "CloneFrom": Map
  }
}

Properti

Properti

Tipe

Diperlukan

Dapat Diedit

Deskripsi

Batasan

ProjectName

String

Ya

Tidak

Nama proyek.

Tidak ada.

LogtailConfigName

String

Ya

Tidak

Nama konfigurasi Logtail.

Nama harus unik dalam sebuah proyek.

Nama harus terdiri dari 2 hingga 128 karakter, dan dapat berisi huruf kecil, angka, tanda hubung (-), serta garis bawah (_). Nama harus dimulai dan diakhiri dengan huruf kecil atau angka.

LogstoreName

String

Ya

Tidak

Nama penyimpanan log (Logstore).

Tidak ada.

RawConfigData

Map

Tidak

Ya

Data konfigurasi mentah.

Formatnya sama dengan format respons dari operasi GetConfig Simple Log Service (SLS).

Jika Anda menentukan CloneFrom dan RawConfigData secara bersamaan, nilai LogtailConfig dan RawConfigData akan digabungkan. Dalam hal ini, nilai configName, outputType, dan outputDetail dalam RawConfigData diabaikan.

Contoh: {"configName": "test-logtail-config", "createTime": 1574843554, "inputDetail": {"acceptNoEnoughKeys": false, "adjustTimezone": false, "advanced": { "force_multiconfig": false }, "autoExtend": true, "delayAlarmBytes": 0, "delaySkipBytes": 0, "discardNonUtf8": false, "discardUnmatch": false, "dockerExcludeEnv": {}, "dockerExcludeLabel": {}, "dockerFile": false, "dockerIncludeEnv": {}, "dockerIncludeLabel": {}, "enableRawLog": false, "enableTag": false, "fileEncoding": "utf8", "filePattern": "test.log*", "filterKey": [], "filterRegex": [], "key": [ "time", "logger", "level", "request_id", "user_id", "region_id", "content" ], "localStorage": true, "logPath": "/var/log/test", "logTimezone": "", "logType": "delimiter_log", "maxDepth": 100, "maxSendRate": -1, "mergeType": "topic", "preserve": true, "preserveDepth": 1, "priority": 0, "quote": "\u0001", "sendRateExpire": 0, "sensitive_keys": [], "separator": ",,,", "shardHashKey": [], "tailExisted": false, "timeFormat": "", "timeKey": "", "topicFormat": "none" }, "inputType": "file", "lastModifyTime": 1574843554, "logSample": "2019-11-27 10:48:23,160,,,MAIN,,,INFO,,,98DCC51D-BE5D-49C7-B3FD-37B2BAEFB296,,,123456789,,,cn-hangzhou,,,this is a simple test.", "outputDetail": { "endpoint": "cn-hangzhou-intranet.log.aliyuncs.com", "logstoreName": "test-logstore", "region": "cn-hangzhou"}, "outputType": "LogService"}.

CloneFrom

Map

Tidak

Ya

Konfigurasi untuk mengkloning konfigurasi Logtail dari proyek lain.

Anda harus menentukan CloneFrom atau RawConfigData.

Untuk informasi lebih lanjut, lihat Properti CloneFrom.

Sintaks CloneFrom

"CloneFrom": {
  "ProjectName": String,
  "LogtailConfigName": String
}

Properti CloneFrom

Properti

Tipe

Diperlukan

Dapat Diedit

Deskripsi

Batasan

ProjectName

String

Ya

Ya

Nama proyek.

Tidak ada.

LogtailConfigName

String

Ya

Ya

Nama konfigurasi Logtail.

Tidak ada.

Nilai kembali

Fn::GetAtt

  • Endpoint: Titik akhir SLS.

  • AppliedMachineGroups: Grup mesin tempat konfigurasi Logtail diterapkan.

  • LogtailConfigName: Nama konfigurasi Logtail.

Contoh

ROSTemplateFormatVersion: '2015-09-01'
Parameters: {}
Resources:
  SlsProject:
    Type: ALIYUN::SLS::Project
    Properties:
      Name:
        Fn::Sub: project-test-${ALIYUN::StackId}
  SlsLogtailConfig:
    Type: ALIYUN::SLS::LogtailConfig
    Properties:
      ProjectName:
        Ref: SlsProject
      LogtailConfigName: app01
      LogstoreName:
        Fn::GetAtt:
          - SlsLogStore
          - LogstoreName
      RawConfigData:
        configName: logtail-test
        outputDetail:
          compressType: ''
          logstoreName:
            Fn::GetAtt:
              - SlsLogStore
              - LogstoreName
        outputType: LogService
        logSample: ''
        inputDetail:
          sensitive_keys: []
          shardHashKey: []
          enableRawLog: false
          logType: common_reg_log
          filterRegex: []
          mergeType: topic
          dockerExcludeEnv: {}
          regex: (.*)
          sendRateExpire: 0
          discardNonUtf8: false
          maxSendRate: -1
          priority: 0
          preserveDepth: 1
          localStorage: true
          logTimezone: ''
          dockerIncludeEnv: {}
          preserve: true
          delayAlarmBytes: 0
          discardUnmatch: false
          logPath: /apsara/nuwa
          dockerExcludeLabel: {}
          topicFormat: none
          maxDepth: 10
          key:
            - content
          filePattern: '*.Log'
          timeFormat: ''
          dockerFile: true
          advanced:
            force_multiconfig: false
            k8s:
              ExternalEnvTag: {}
            collect_containers_flag: false
            tail_size_kb: 1024
          dockerIncludeLabel: {}
          delaySkipBytes: 0
          filterKey: []
          tailExisted: false
          adjustTimezone: false
          logBeginRegex: .*
          fileEncoding: utf8
          enableTag: false
        inputType: file
  SlsLogStore:
    Type: ALIYUN::SLS::Logstore
    Properties:
      ProjectName:
        Ref: SlsProject
      AutoSplit: true
      MaxSplitShard: 64
      LogstoreName: mytest
      AppendMeta: true
      ShardCount: 2
      EnableTracking: false
      PreserveStorage: true
Outputs: {}
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
  },
  "Resources": {
    "SlsProject": {
      "Type": "ALIYUN::SLS::Project",
      "Properties": {
        "Name": {
          "Fn::Sub": "project-test-${ALIYUN::StackId}"
        }
      }
    },
    "SlsLogStore": {
      "Type": "ALIYUN::SLS::Logstore",
      "Properties": {
        "LogstoreName": "mytest",
        "PreserveStorage": true,
        "ProjectName": {
          "Ref": "SlsProject"
        },
        "AppendMeta": true,
        "MaxSplitShard": 64,
        "AutoSplit": true,
        "EnableTracking": false,
        "ShardCount": 2
      }
    },
    "SlsLogtailConfig": {
      "Type": "ALIYUN::SLS::LogtailConfig",
      "Properties": {
        "ProjectName": {
          "Ref": "SlsProject"
        },
        "LogtailConfigName": "app01",
        "LogstoreName": {
          "Fn::GetAtt": [
            "SlsLogStore",
            "LogstoreName"
          ]
        },
        "RawConfigData": {
          "configName": "logtail-test",
          "inputDetail": {
            "adjustTimezone": false,
            "advanced": {
              "collect_containers_flag": false,
              "force_multiconfig": false,
              "k8s": {
                "ExternalEnvTag": {}
              },
              "tail_size_kb": 1024
            },
            "delayAlarmBytes": 0,
            "delaySkipBytes": 0,
            "discardNonUtf8": false,
            "discardUnmatch": false,
            "dockerExcludeEnv": {},
            "dockerExcludeLabel": {},
            "dockerFile": true,
            "dockerIncludeEnv": {},
            "dockerIncludeLabel": {},
            "enableRawLog": false,
            "enableTag": false,
            "fileEncoding": "utf8",
            "filePattern": "*.Log",
            "filterKey": [],
            "filterRegex": [],
            "key": [
              "content"
            ],
            "localStorage": true,
            "logBeginRegex": ".*",
            "logPath": "/apsara/nuwa",
            "logTimezone": "",
            "logType": "common_reg_log",
            "maxDepth": 10,
            "maxSendRate": -1,
            "mergeType": "topic",
            "preserve": true,
            "preserveDepth": 1,
            "priority": 0,
            "regex": "(.*)",
            "sendRateExpire": 0,
            "sensitive_keys": [],
            "shardHashKey": [],
            "tailExisted": false,
            "timeFormat": "",
            "topicFormat": "none"
          },
          "inputType": "file",
          "logSample": "",
          "outputDetail": {
            "compressType": "",
            "logstoreName": {
              "Fn::GetAtt": [
                "SlsLogStore",
                "LogstoreName"
              ]
            }
          },
          "outputType": "LogService"
        }
      }
    }
  },
  "Outputs": {
  }
}