doc/userguide/lua/libs/log.rst
Log
The suricata.log Lua library exposes the Suricata application
logging functions to Lua scripts. These are equivalant to
SCLogNotice, SCLogError, etc, in the Suricata source.
In Suricata, the logging priority order is:
.. note:: Debug logging will only work if Suricata was compiled with
--enable-debug.
Setup
To use the logging functions, first require the module::
local logger = require("suricata.log")
Functions
infoLog an informational message::
logger.info("Processing HTTP request")
This is equivalent to SCLogInfo.
noticeLog a notice message::
logger.notice("Unusual pattern detected")
This is equivalent to SCLogNotice.
warningLog a warning message::
logger.warning("Connection limit approaching")
This is equivalent to SCLogWarning.
errorLog an error message::
logger.error("Failed to parse data")
This is equivalent to SCLogError.
debugLog a debug message (only visible when debug logger.ing is enabled)::
logger.debug("Variable value: " .. tostring(value))
This is equivalent to SCLogDebug.
configLog a configuration-related message::
logger.config("Loading configuration from " .. filename)
This is equivalent to SCLogConfig.
perfLog a performance-related message::
logger.perf("Processing took " .. elapsed .. " seconds")
This is equivalent to SCLogPerf.