grok学习
1 min read

grok学习

源日志

[06/Nov/2020:13:50:30 +0800] <47> 192.168.87.0 "GET /api/v1/lms/forum/live/comments/?cid=5737363&topic_id=1514809 HTTP/1.1" 200 0.107130 40 "https://www.exapmle.com/live/live20201105m001/live20201105m001/5737363/8404032" "Mozilla/5.0 (Linux; Android 10; TAS-AL00 Build/HUAWEITAS-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045410 Mobile Safari/537.36 MMWEBID/5585 MicroMessenger/7.0.15.1680(0x27000F50) Process/tools WeChat/arm32 NetType/WIFI Language/zh_CN ABI/arm64" "university_id=2741; platform_id=3; csrftoken=0aXekK4SlSaBiNuqh7VrncMPHiP9ZUZb; sessionid=t03symkjaei649ss3pryfk2lc9nzpikk; user_role=3" "xt" "-" "kulTK5PnKlhxp2v1jdYPXLdrH50V86Aj" "-" "223.6.6.6,114.114.114.114" -

grok模板

\[%{HTTPDATE:time}\] %{DATA} %{IP:remote_addr} \"%{WORD:methed} %{DATA:url}HTTP/%{NUMBER:http_version}\" %{NUMBER:status} %{NUMBER:request_time} %{NUMBER:request_len} \"%{DATA:referer}\" \"%{DATA:http_user_agent}\" \"%{DATA:cookie}\" \"%{DATA:xtbz}\" \"%{DATA:university-id}\" \"%{DATA:x-csrftoken}\" \"%{DATA:set-cookie}\" \"%{DATA:x-forward-for}\" %{DATA:u}

解析结果如下:

{
"remote_addr": "192.168.87.0",
"referer": "https://www.example.com/live/live20201105m001/live20201105m001/5737363/8404032",
"university-id": "-",
"cookie": "university_id=2741; platform_id=3; csrftoken=0aXekK4SlSaBiNuqh7VrncMPHiP9ZUZb; sessionid=t03symkjaei649ss3pryfk2lc9nzpikk; user_role=3",
"x-csrftoken": "kulTK5PnKlhxp2v1jdYPXLdrH50V86Aj",
"http_version": "1.1",
"xtbz": "xt",
"methed": "GET",
"url": "/api/v1/lms/forum/live/comments/?cid=5737363&topic_id=1514809 ",
"http_user_agent": "Mozilla/5.0 (Linux; Android 10; TAS-AL00 Build/HUAWEITAS-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045410 Mobile Safari/537.36 MMWEBID/5585 MicroMessenger/7.0.15.1680(0x27000F50) Process/tools WeChat/arm32 NetType/WIFI Language/zh_CN ABI/arm64",
"set-cookie": "-",
"x-forward-for": "223.6.6.6,114.114.114.11",
"request_time": "0.107130",
"request_len": "40",
"u": "",
"time": "06/Nov/2020:13:50:30 +0800",
"status": "200"
}
京ICP备19055754号