If you are planning on using Fail2Ban and wish to receive emails on any failed attempts to access your Nextcloud server. Just add the following lines to your nextcloud.local:
action_mw = %(action_)s
%(mta)s-whois[sender=ā%(sender)sā, dest=ā%(destemail)sā, protocol=ā%(protocol)sā, chain=ā%(chain)sā]
action = %(action_mwl)s
Your final configuration should look like this.
[nextcloud]
backend = auto
enabled = true
port = 80,443
protocol = tcp
filter = nextcloud
maxretry = 3
bantime = 86400
findtime = 43200
logpath = /var/www/nextcloud/data/nextcloud.log
action_mw = %(action_)s
%(mta)s-whois[sender=ā%(sender)sā, dest=ā%(destemail)sā, protocol=ā%(protocol)sā, chain=ā%(chain)sā]
action = %(action_mwl)s