Teach how to get log messages from logger command and write to files conditionally.
Installing and configuring Rsyslog
Configuration format