閱讀507 返回首頁    go iPhone_iPad_Mac_手機_平板_蘋果apple


GetConfig__Logtail配置相關接口_API-Reference_日誌服務-阿裏雲

獲得一個配置詳細信息

示例:

GET /configs/{configName}

請求語法

GET /configs/<configName> HTTP/1.1
Authorization: <AuthorizationString> 
Date: <GMT Date>
Host: <Project Endpoint>
x-log-apiversion: 0.6.0
x-log-signaturemethod: hmac-sha1

請求參數

參數名稱 類型 是否必須 描述
ConfigName String 日誌配置名稱

請求頭

無特有請求頭,關於API的公共請求頭請參考公共請求頭

響應頭

無特有響應頭,關於API的公共響應頭請參考公共響應頭

響應元素

屬性名稱 類型 描述
configName string 日誌配置名稱, Project下唯一
inputType string 輸入類型,現在隻支持"file"
inputDetail json 見下表格說明
outputType string 輸出類型,現在隻支持為"LogService"
outputDetail json 見下表格說明
createTime Int 配置創建時間
lastModifyTime Int 該資源服務端更新時間

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內容:

屬性名稱 類型 必須 描述
endpoint string Project所在的訪問地址,不需要帶Project前綴,如果不填寫,則使用默認EndPoint
logstoreName string 對應logstore名字

錯誤碼

除了返回API的通用錯誤碼,還可能返回如下特有錯誤碼:

HTTP狀態碼 ErrorCode ErrorMessage
404 ConfigNotExist Config {Configname} not exist
500 InternalServerError Specified Server Error Message

細節描述

示例

請求示例:
GET /configs/logtail-config-sample 
Header :
{
    "Content-Length": 0,
    "x-log-signaturemethod": "hmac-sha1",
    "x-log-bodyrawsize": 0,
    "User-Agent": "log-python-sdk-v-0.6.0",
    "Host": "ali-test-project.cn-hangzhou-devcommon-intranet.sls.aliyuncs.com",
    "Date": "Mon, 09 Nov 2015 08:29:15 GMT",
    "x-log-apiversion": "0.6.0",
    "Authorization": "LOG 94to3z418yupi6ikawqqd370:yV5LsYLmn1UrAXvBg8CbZNZoiTk="
}
響應示例:
Header :
{   
    "content-length": "730",
    "server": "nginx/1.6.1",
    "connection": "close",
    "date": "Mon, 09 Nov 2015 08:29:15 GMT",
    "content-type": "application/json",
    "x-log-requestid": "5640595B99248CAA23004A59"
}
Body :
{   
    "configName": "logtail-config-sample",
    "outputDetail": {
        "endpoint": "https://cn-hangzhou-devcommon-intranet.sls.aliyuncs.com",
        "logstoreName": "sls-test-logstore"
    },
    "outputType": "LogService",
    "inputType": "file",
    "inputDetail": {
        "regex": "([\d\.]+) \S+ \S+ \[(\S+) \S+\] "(\w+) ([^"]*)" ([\d\.]+) (\d+) (\d+) (\d+|-) "([^"]*)" "([^"]*)".*",
        "filterKey": [],
        "logPath": "/var/log/httpd/",
        "logBeginRegex": "\d+\.\d+\.\d+\.\d+ - .*",
        "logType": "common_reg_log",
        "topicFormat": "none",
        "localStorage": true,
        "key": [
            "ip",
            "time",
            "method",
            "url",
            "request_time",
            "request_length",
            "status",
            "length",
            "ref_url",
            "browser"
        ],
        "filePattern": "access*.log",
        "timeFormat": "%d/%b/%Y:%H:%M:%S",
        "filterRegex": []
    },
    "createTime": 1447040456,
    "lastModifyTime": 1447050456
}

最後更新:2016-11-23 16:04:03

  上一篇:go GetAppliedMachineGroups__Logtail配置相關接口_API-Reference_日誌服務-阿裏雲
  下一篇:go DeleteConfig__Logtail配置相關接口_API-Reference_日誌服務-阿裏雲