remove some fileds dont need
Hello, I want to remove some fileds that i dont need. So i write rules file as following:
include: ["time_local","num_hits", "num_matches", "host", "request", "remote_addr", "status_code"]
But , it still added the extra fileds that i dont need. Such as following, the _id, _index, _type,these are what i dont need. So how to remove these fileds? Thanks!
_id: AV3fleL8usrk5H9HHErN
_index: nginx-access-2017-08-14
_type: nginx-access
host: abcd.com
num_hits: 11765
num_matches: 2353
remote_addr: 111.202.5.251
request: GET /admin/home HTTP/1.1
status_code: 200
time_local: 14/Aug/2017:00:12:05 -0700
@qianghaohao
Please try the below to see if you get the required output.
alert_text_type: exclude_fields
alert_text: |
This is a test email please ignore. ElastAlert has detected something Do some thing about it.
Host: {}
No of hits: {}
No of matches: {}
Remote Address: {}
Request URL: {}
HTTP Status Code: {}
Time: {}
alert_text_args:
- host
- num_hits
- num_matches
- remote_addr
- request
- status_code
- timestamp
@sathishdsgithub Thans you very much, that worded!!! Wonderfull!!!!
@sathishdsgithub Hello, another problem: After use your config and i use the agreation config, i get the result in a mail as following:
主机: www.priorityregroup.com
请求URL: GET /wp-login.php HTTP/1.1
HTTP状态码: 404
远程IP地址: 217.132.204.109
日志时间戳: 14/Aug/2017:02:25:15 -0700
总查询次数: 32
总异常次数: 6
原始日志信息: 14/Aug/2017:02:25:15 -0700|52.52.24.52|GET /wp-login.php HTTP/1.1|404|-|217.132.204.109|Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1|-|www.priorityregroup.com|5800|0.246|0.246|172.31.6.172:13030|41361050|2|460b3121-ad35-4e0d-9fde-9d562a42b482
At least 5 events occurred between 2017-08-14 02:20 PDT and 2017-08-14 02:25 PDT
----------------------------------------
5分钟内nginx异常状态码个数超过阀值(>=5),触发报警
主机: www.priorityregroup.com
请求URL: GET /wp-login.php HTTP/1.1
HTTP状态码: 404
远程IP地址: 217.132.204.109
日志时间戳: 14/Aug/2017:02:25:17 -0700
总查询次数: 32
总异常次数: 6
原始日志信息: 14/Aug/2017:02:25:17 -0700|52.52.24.52|GET /wp-login.php HTTP/1.1|404|-|217.132.204.109|Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1|-|www.priorityregroup.com|5383|0.233|0.233|172.31.6.172:13030|41361050|5|5dd594c6-d0b6-4f93-8427-09ca5ba931c1
At least 5 events occurred between 2017-08-14 02:20 PDT and 2017-08-14 02:25 PDT
----------------------------------------
5分钟内nginx异常状态码个数超过阀值(>=5),触发报警
主机: www.logpondrealty.com
请求URL: HEAD /feed/ HTTP/1.1
HTTP状态码: 404
远程IP地址: 35.190.203.87
日志时间戳: 14/Aug/2017:02:25:27 -0700
总查询次数: 32
总异常次数: 6
原始日志信息: 14/Aug/2017:02:25:27 -0700|52.52.24.52|HEAD /feed/ HTTP/1.1|404|-|35.190.203.87|Go-http-client/1.1|http://logpondrealty.com/feed/|www.logpondrealty.com|915|0.264|0.109|172.31.21.88:13030|41361111|1|c057757a-e8ec-4c47-82fd-acb81e913f96
At least 5 events occurred between 2017-08-14 02:20 PDT and 2017-08-14 02:25 PDT
So, how to aggregate these three items into one table? Example: +----------+---------+---------+---------+---------+---------+---------+-------+ | 主机 | 请求URL |状态码 | 远程IP |日志时间 | 总查询次数 | 总异常次数 | 原始日志信息| +==========+=========+=========+=========+=========+=========+ | | | | | | | | | +----------+---------+---------+---------+---------+---------+---------+-------+ I user the summary_table_fields,but it seems that the alert_text are extra and the table format are desordenado.
@sathishdsgithub The following are part of my config file:
alert_text_type: exclude_fields
alert_text: |
5分钟内nginx异常状态码个数超过阀值(>=5),触发报警
主机: {}
请求URL: {}
HTTP状态码: {}
远程IP地址: {}
日志时间戳: {}
总查询次数: {}
总异常次数: {}
原始日志信息: {}
alert_text_args:
- host
- request
- status_code
- remote_addr
- time_local
- num_hits
- num_matches
- message
summary_table_fields:
- host
- request
- status_code
- remote_addr
- time_local
- num_hits
- num_matches