apache - Logstash count by unique IP -



apache - Logstash count by unique IP -

i'm trying log analysis logstash.

i need count unique ips apache access log, need match them count filter, determine if email sent.

something this: if 10+ access unique ip in 5 minutes interval found, them need send email ip on it.

what best solution this?

doing surprisingly hard -- need create meter per ip address. 1 time have meter per ip address, need @ it's rate_5m , decide if it's on threashold (note rate_5m per sec rate on lastly 5 minutes). 1 time you've decided need send off alert, you'll want include ip address in (so need extract using ruby filter)... in all, not sure i'd ever utilize in production because chew memory crazy (because of meter per ip address).

filter { metrics { meter => "%{ip}" add_tag => ["metric"] } ruby { code => ' ip = nil if event["tags"].include? "metric" event.to_hash.each |key,value| if key.end_with?(".rate_5m") , value > 0.2 ip = key[0..-9] end end end if ip event["ip"] = ip event["tags"] = ["alert"] end ' } } output { if "alert" in [tags] { email { ... } } }

you write custom filter smarter using trending algorithm find ip addresses trending higher in count.

apache logging ip logstash metrics

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -