我希望能解析nginx错误日志文件并将解析后的格式放入elasticsearch。我已经成功地对access.log进行了同样的操作,因为它接受log_format指令,但error.log并不支持该指令。我有以下样本错误日志,主要感兴趣:
2018/01/10 06:26:31 [error] 13485#13485: *64285471 limiting connections by zone "rl_conn", client: xx.xx.xx.xx, server: www.xyz.com, request: "GET /api/xyz HTTP/1.1", host: "www.xyz.com"
我想通过某个解析器对其进行解析,以便获得Json格式的数据,如下所示:
{client: "xx.xx.xx.xx", server: "www.xyz.com", host: "www.xyz.com", "request": "GET /api/xyz HTTP/1.1", reason: "limiting connections by zone "rl_conn""}
有人能在这里提供帮助吗?