调用GetConfig接口获取日志采集配置的详细信息。

请求语法

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

请求参数

  • 请求头

    GetConfig接口无特有请求头。关于Log Service API的公共请求头,请参见公共请求头

  • 参数列表
    参数名称 类型 是否必须 示例值 描述
    ConfigName String logtail-config-sample 日志配置名称。

返回数据

  • 响应头

    GetConfig接口无特有响应头。关于Log Service API的公共响应头,请参见公共响应头

  • 响应元素

    响应内容中包含的参数信息和各种模式的Logtail配置样例,请参见Logtail配置

示例

  • 请求示例
    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 <yourAccessKeyId>:<yourSignature>"
    }
  • 正常返回示例
    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": "http://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
    }

错误码

除了返回Log Service API的通用错误码,还可能返回如下特有错误码:
HTTP状态码 错误码 错误信息 描述
404 ConfigNotExist Config {Configname} does not exist. 日志配置不存在。
500 InternalServerError Specified Server Error Message. 内部服务调用错误。