Kong 日志说明

1、日志格式

下面是一个访问具体的日志,查看命令:sudo tail -f /var/log/messages

{
    "client_ip": "192.168.10.111",
    "request": {
        "method": "POST",
        "uri": "\/apps\/insight-notification\/api\/notification\/list",
        "size": "1166",
        "request_uri": "http:\/\/shrek.avlyun.org:8000\/apps\/insight-notification\/api\/notification\/list",
        "querystring": {},
        "headers": {
            "x-consumer-id": "5830f4a9-8d7b-4a99-80d6-f6a741700af4",
            "x-consumer-groups": "insight-intelligence-api, insight-warning-api, insight-acl-api, insight-notification-api",
            "accept": "application\/json,text\/*,*\/*",
            "x-consumer-username": "fe-v2-intelligence-analysis",
            "host": "shrek.avlyun.org",
            "x-forwarded-proto": "http",
            "x-request-id": "3D9F5710-CECC-4120-B393-69104B2D1C06",
            "x-forwarded-for": "192.168.10.111, 192.168.12.96",
            "content-type": "application\/json",
            "accept-language": "zh-CN,zh;q=0.8",
            "content-length": "83",
            "x-client": "insight-intelligence",
            "x-request-with": "insight-web",
            "referer": "http:\/\/shrek.avlyun.org\/intelligence",
            "accept-encoding": "gzip, deflate",
            "x-access-key": "490899fad7391947",
            "user-agent": "Mozilla\/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/55.0.2883.87 Safari\/537.36",
            "origin": "http:\/\/shrek.avlyun.org",
            "x-agent": "v2-intelligence-analysis",
            "apikey": "f3ae32294ca449a99486529be0e0f981",
            "dnt": "1",
            "authorization": "bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1MTAyMTQ4NzAsImV4cCI6MTUxMDIyMjA3MCwiaWF0IjoxNTEwMjE0ODcwLCJpc3MiOiJjMzU1OTRmODcxZjc3ZGM2K2luc2lnaHQtYXV0aCIsImp0aSI6ImZlMTIxNTEzMmM3M2M1YzJjOGRiNzM2ODMxNWNhYzY3Iiwic3ViIjo0NDQsImRzcCI6ImNoZW5nY29uZ0BhbnRpeS5jbiJ9.Q9YtjR7AdyP5dLugD8ZCyqa2s5Z6wLUxQ-AoLEijAEk"
        }
    },
    "consumer": {
        "username": "fe-v2-intelligence-analysis",
        "created_at": 1505287736000,
        "id": "5830f4a9-8d7b-4a99-80d6-f6a741700af4"
    },
    "response": {
        "status": 200,
        "size": "1312",
        "headers": {
            "x-powered-by": "PHP\/7.0.11",
            "content-type": "application\/json",
            "connection": "close",
            "cache-control": "no-cache",
            "x-kong-proxy-latency": "0",
            "via": "kong\/0.10.3",
            "x-kong-upstream-latency": "46",
            "vary": "Accept-Encoding",
            "content-encoding": "gzip",
            "transfer-encoding": "chunked",
            "server": "Apache"
        }
    },
    "authenticated_entity": {
        "consumer_id": "5830f4a9-8d7b-4a99-80d6-f6a741700af4",
        "id": "be85983b-d24c-4fb1-acd0-1da28767168a"
    },
    "latencies": {
        "request": 46,
        "kong": 0,
        "proxy": 46
    },
    "started_at": 1510215969943,
    "tries": [{
            "ip": "192.168.48.74",
            "port": 8625
        }
    ],
    "api": {
        "uris": ["\/apps\/insight-notification\/api"],
        "id": "d2062db1-e6c4-4df8-996b-e4654c532b92",
        "upstream_read_timeout": 60000,
        "preserve_host": true,
        "created_at": 1509007269000,
        "upstream_connect_timeout": 2000,
        "upstream_url": "http:\/\/192.168.48.74:8625",
        "strip_uri": false,
        "https_only": false,
        "name": "insight-notification-api",
        "http_if_terminated": true,
        "upstream_send_timeout": 2000,
        "retries": 5
    }
}

2、对上游服务的说明

所有通过 kong 的请求,都会添加一定的 header,参考链接如下:https://getkong.org/plugins/key-authentication/

Kong 日志说明_第1张图片
kong-upstream-headers.png

你可能感兴趣的:(Kong 日志说明)