Keyloggers are to all intents and purposes PUPs (Potentially Unwanted Programs), not all key-loggers are malicious, many are commercial packages, so they aren't blocked by default.
So you need to enable Scan for PUPs in the avastUI, real-time shields, file system shield, expert settings, Sensitivity, see image. I would recommend that you also set the Actions for PUPs to Ask as the first action as you will be surprised what may be flagged as a PUP, many tools are considered PUPs as the can be used for good or evil.