goreplay icon indicating copy to clipboard operation
goreplay copied to clipboard

Why ElasticSearch output save fields in encoded form

Open zhangcheng opened this issue 11 years ago • 2 comments

I use the latest v0.10.1 version.

In ElasticSearch, I see things like:

"_source": {
    "Req_URL": "YjNkNGQ1ZDY4ODQ1NGI1NGFkNGEzOGQwZjE3MGY5MjZlMzdjYTVmZg==",
    "Req_Method": "MQ==",
    "Req_User-Agent": "SFRUUGllLzAuOS4y",
    "Req_Accept": "Ki8q",
    "Req_Accept-Encoding": "Z3ppcCwgZGVmbGF0ZQ==",
    "Req_Connection": "a2VlcC1hbGl2ZQ==",
    "Resp_Status": "MzAy",
    "Resp_Status-Code": "MzAy",
    "Resp_Proto": "SFRUUC8xLjE=",
    "Resp_Content-Length": "Mjcz",
    "Resp_Content-Type": "dGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04",
    "RTT": 6,
    "Timestamp": "2015-11-17T14:32:55.093369682Z"
  },

My Go knowledge is limited, but I couldn't find any likely encoding logic in https://github.com/buger/gor/blob/master/elasticsearch.go

zhangcheng avatar Nov 17 '15 15:11 zhangcheng

See this issue https://github.com/buger/gor/issues/232.

buger avatar Apr 25 '16 11:04 buger

Whatever little time that I spent, I could figure out the encoding issue is because members of ESRequestResponse is of byte[]. Converting them to string solves the issue.

https://github.com/buger/gor/blob/master/elasticsearch.go line 123 & 124

  ReqUrl:               proto.Path(req),
  ReqMethod:            proto.Method(req),

This method doesn't skip the first line of the request packet (uudid and ts). What is the right method to extract path and method from req?

uttamatsimility avatar Apr 25 '16 18:04 uttamatsimility