閱讀674 返回首頁    go 阿裏雲 go 技術社區[雲棲]


Logtail配置__公共資源說明_API-Reference_日誌服務-阿裏雲

Logtail配置叫做Config,每個Project默認可以創建100個配置(Config),Config名在Project下具備唯一性。 用戶可以通過Config指定日誌收集的位置、方式和參數。

  • Config命名規範
    • 隻能包括小寫字母,數字,短橫線(-)和下劃線(_)
    • 必須以小寫字母或者數字開頭和結尾
    • 長度必須在2-128字節以內

完整資源示例:

{
    "configName": "testcategory1",
    “inputType”: ”file”,
    "inputDetail": {
        “logType”: “common_reg_log”,
        “logPath”: “/var/log/httpd/”,
        “filePattern”: “access.log”,
        “localStorage”: true,
        “timeFormat”: “%Y/%m/%d %H:%M:%S”,
        “logBeginRegex”: “.*”,
        “regex”: “(w+)(s+)”,
        “key” :[“key1”, “key2”],
        “filterKey”:[“key1”],
        “filterRegex”:[“regex1”],
        “topicFormat”: “none”
    },
    “outputType”: ”sls”,
    “outputDetail”: 
    {
        “logstoreName”: ”perfcounter”
    },
    “createTime": 1400123456,
    “lastModifyTime": 1400123456
}
屬性名稱 類型 是否必須 描述
configName string 日誌配置名稱, Project下唯一
inputType string 輸入類型,默認為file
inputDetail json 見下表格說明
outputType string 輸出類型,目前隻支持LogService
outputDetail string 見下表格說明
createTime(output-only) integer 配置創建時間
lastModifyTime(output-only) integer 該資源服務端更新時間

inputDetail內容:

屬性名稱 類型 必須 描述
logType string 日誌類型,現在隻支持"common_reg_log"
logPath string 日誌所在的父目錄,例如 /var/logs/
filePattern string 日誌文件的Pattern,例如 access*.log
localStorage boolean 是否打開本地緩存,在服務端之間鏈路斷開情況下,本地可以緩存1GB日誌
timeFormat string 日誌時間格式, 如 "%Y/%m/%d %H:%M:%S"
logBeginRegex string 日誌首行特征(正則表達式),由於匹配多行日誌組成一條log的情況
regex string 日誌對提取正則表達式
key array 日誌提取後所生成Key
filterKey array 用於過濾日誌所用到的key,隻有key的值滿足對應filterRegex列中設定的正則表達式日誌才是符合要求的
filterRegex array 和每個filterKey對應的正正則表達式, filterRegex的長度和filterKey的長度必須相同
topicFormat string 用於將日誌文件路徑的某部分作為topic,如/var/log/(.*).log,默認為none,表示topic為空。
preserve boolean true代表監控目錄永不超時,false代表監控目錄30分鍾超時,默認值為true
preserveDepth integer 當設置preserve為false時,指定監控不超時目錄的深度,最大深度支持3

outputDetail內容:

屬性名稱 類型 必須 描述
logstoreName string 對應logstore名字

最後更新:2016-11-24 11:23:47

  上一篇:go 分區__公共資源說明_API-Reference_日誌服務-阿裏雲
  下一篇:go Logtail機器組__公共資源說明_API-Reference_日誌服務-阿裏雲