How to get list of all IP addresses unbanned by Fail2ban

List of all IP addresses unbanned by Fail2ban:

$ sudo zgrep -h "Unban " /var/log/fail2ban.log* | awk '{print $NF}' | sort | uniq -c

To sort in ascending order by count of unbanned, use below command

$ sudo zgrep -h "Unban " /var/log/fail2ban.log* | awk '{print $NF}' | sort | uniq -c | sort -n

List of all IP addresses unbanned by Fail2ban, grouped by IP address and Hostname:

Logresolve command is not installed by default, you have to install logresolve before running this command

$ sudo zgrep -h "Unban " /var/log/fail2ban.log* | awk '{print $NF}' | sort | awk '{print $1,"("$1")"}' | logresolve | uniq -c

To sort in ascending order by count of unbanned, use below command

$ sudo zgrep -h "Unban " /var/log/fail2ban.log* | awk '{print $NF}' | sort | awk '{print $1,"("$1")"}' | logresolve | uniq -c | sort -n

More more ways to analyse Fail2ban logs, please visit Fail2ban Log Analysis