log & alarm logic