我有一个 nginx 日志文件,看起来类似于这个:
{ "@timestamp": "2013-09-03T14:21:51-04:00", "@fields": { "remote_addr": "xxxxxxxxxxxx", "remote_user": "-", "body_bytes_sent": "5", "request_time": "0.000", "status": "200", "request": "POST foo/bar/1 HTTP/1.1", "request_body": "{\x22id\x22: \x22460\x22, \x22source_id\x22: \x221\x22, \x22email_address\x22: \x22foo@bar.com\x22, \x22password\x22: \x2JQ6I\x22}", "request_method": "POST", "request_uri": "foo/bar/1", "http_referrer": "-", "http_user_agent": "Java/1.6.0_27" } }
我想知道是否可以使用logstash
过滤器发送类似于以下内容的日志:
{"@fields": { "request": "POST foo/bar/1 HTTP/1.1", "request_body": "{\x22id\x22: \x22460\x22, \x22source_id\x22: \x221\x22, \x22email_address\x22: \x22foo@bar.com\x22, \x22password\x22: \x2JQ6I\x22}"}
所以我只对整个日志中的几个领域感兴趣。
换句话说,我想从日志中提取必要的数据,然后将其发送到任何输出