Posts tagged graylog2

Generate a simple report of attacks on your servers from Graylog2 data using MapReduce

Whilst setting up centralised logging for one of our clients clusters, it was noticed that there are sometimes a large number of failed login attempts. Rather than manually checking each one, I’ve written a script using PHP and MongoDB JS MapReduce to aggregate the data and provide a useful report.

The following code will output a CSV report with the columns;

  • Offending IP address
  • Your servers hostname
  • The number of entries which matched

It’s not 100% fool proof, but provides us with a good guide with where to look / block first.

p.s. We also have a slightly modified version which allows checking of a list of IP addresses against successful logins…