1234567891011121314 |
- package po
- import (
- "encoding/json"
- "testing"
- )
- func TestNginxAccessLog_FixFields(t *testing.T) {
- arg := &NginxAccessLog{}
- line := `{"time_local": "2025-01-09T10:47:57+08:00", "remote_addr": "205.210.31.222", "referer": "-", "request": "\x16\x03\x01\x00\xEE\x01\x00\x00\xEA\x03\x03\x1C\xCD.\xCD\x04\xDF*\xD0\xFE\xD3&\xE5\x08.\x05\xFB\x80W\x129=\x91\x1F1\xECv\xE9\xF8D\xEA\xAA\xE8 \x92*}b\xBEA\x7F\x95I\x0B\x15\xEA\xB3\xBD\xD4\x8A\xC02o%wB\xA60Bf\xAAI\xCB\xAA\xE3|\x00&\xC0+\xC0/\xC0,\xC00\xCC\xA9\xCC\xA8\xC0\x09\xC0\x13\xC0", "status": 400, "body_bytes_sent": "173", "agent": "-", "x_forwarded": "-", "up_addr": "-","up_host": "-","up_resp_time": "-","request_time": "5.000", "request_length": "0", "request_id": "0fa54deb2fd2190b9f66b2f4b53cf66c", "host": "_" }`
- if err := json.Unmarshal([]byte(line), arg); err != nil {
- t.Errorf(err.Error())
- }
- }
|