阅读507 返回首页    go 阿里云


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_日志服务-阿里云