ModSecurity is an open source, cross platform web application firewall (WAF) engine for Apache, IIS and Nginx. It has a robust event-based programming language which provides protection from a range of attacks against web applications and allows for HTTP traffic monitoring, logging and real-time analysis.
I know a lot changed between 2.x and 3.x and seeing as how 3.x was released in 2017 documentation on it would be helpful.