This is rather strange. Usually when you see this problem, the keyboard switches under the key tops are sticking, and that causes the problem. However, you tried another keyboard with the same results, so that suggests otherwise. I suggest that the first thing you do is to uninstall all your Logitech drivers, reboot a few times, and then reinstall them using the latest drivers for your hardware downloaded directly from Logitech. Let's see if that accomplishes anything.
This does not sound like malware either.
BTW, all those are USB based. Do you connect them directly to the USB sockets on the rear of your system, or do you connect them via a USB hub or from front panel connectors. And, what version of Windows are you using, including service pack.