1. 程式人生 > >elastalert告警處理

elastalert告警處理

使用POST的方式接收告警,然後後端自己處理。 接收到的告警資料如下:

{u'total_time': 0.002, u'http_user_agent': u'"Java/1.8.0_91"', u'@timestamp': u'2018-10-23T09:56:30.203Z', u'kafka': {u'topic': u'nginx-access-lan', u'partition': 4, u'consumer_group': u'logstash', u'key': None, u'offset': 3004012347}, u'num_matches': 297257, u'message': u'tsdb.daojia-inc.com 10.37.15.10 - - [23/Oct/2018:17:56:29 +0800] http "POST /api/put HTTP/1.1" 204 152 "-" "Java/1.8.0_91" "-" "-" 0.001 10.37.14.28:4242 204 0.001 ', u'upstream_addr1': u'10.37.14.28:4242', u'remote_user': u'-', u'uripath': u'/api/put', u'request_time': 0.001, u'http_referer': u'"-"', u'remote_addr': u'10.37.15.10', u'input_type': u'log', u'rule_level': u'low', u'source': u'/opt/log/nginx/tsdb.daojia-inc.com/tsdb.daojia-inc.com_access.log', u'scheme': u'http', u'type': u'nginx-access-lan', u'method': u'POST', u'status': u'204', u'_type': u'nginx-access-lan', u'upstream_response_time1': 0.001, u'tags': [u'_geoip_lookup_failure'], u'beat': {u'hostname': u'37-8-45', u'name': u'37-8-45', u'version': u'5.5.1'}, u'num_hits': 297257, u'rule_name': u'zhaoliu5', u'http_host': u'tsdb.daojia-inc.com', u'offset': 4592173454, u'upstream_status1': u'204', u'_index': u'nginx-access-lan-2018.10.23', u'fields': {u'd_type': u'dop-ngx'}, u'bytes_sent': 152, u'http_version': u'1.1', u'time_local': u'23/Oct/2018:17:56:29 +0800', u'_id': u'AWagWrZ7UlWvh8PPPS4d', u'@version': u'1', u'geoip': {}}
data_dict.....................: {u'status': u'', u'endpoint': u'37-8-45', u'service': u'', u'env': u'37', u'timestamp': u'2018-10-23T09:56:30Z', u'ip': u'45', u'region': u'8', u'metric': u'/opt/log/nginx/tsdb.daojia-inc.com/tsdb.daojia-inc.com_access.log', u'value': u'tsdb.daojia-inc.com 10.37.15.10 - - [23/Oct/2018:17:56:29 +0800] http "POST /api/put HTTP/1.1" 204 152 "-" "Java/1.8.0_91" "-" "-" 0.001 10.37.14.28:4242 204 0.001 ', u'dataSource': u'elk'}