Logging for security analysis