Implement clearing log and set up guards in publications agaisnt undefined userId