From f56bd4db7581382a90c14a002fd5dd0e3f0d169f Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Mon, 28 Jul 2025 15:59:01 -0600 Subject: [PATCH] doc/lua-output: fix example script for new apis Ticket: #7728 --- doc/userguide/output/lua-output.rst | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/userguide/output/lua-output.rst b/doc/userguide/output/lua-output.rst index 597de6c561..8cb3b03e9e 100644 --- a/doc/userguide/output/lua-output.rst +++ b/doc/userguide/output/lua-output.rst @@ -29,6 +29,9 @@ Example: local config = require("suricata.config") local logger = require("suricata.log") + local http = require("suricata.http") + local packet = require("suricata.packet") + local flow = require("suricata.flow") function init (args) local needs = {} @@ -44,26 +47,29 @@ Example: end function log(args) - http_uri = HttpGetRequestUriRaw() + local tx = http.get_tx() + + http_uri = tx:request_uri_raw() if http_uri == nil then http_uri = "" end http_uri = string.gsub(http_uri, "%c", ".") - http_host = HttpGetRequestHost() + http_host = tx:request_host() if http_host == nil then http_host = "" end http_host = string.gsub(http_host, "%c", ".") - http_ua = HttpGetRequestHeader("User-Agent") + http_ua = tx:request_header("User-Agent") if http_ua == nil then http_ua = "" end http_ua = string.gsub(http_ua, "%g", ".") - timestring = SCPacketTimeString() - ip_version, src_ip, dst_ip, protocol, src_port, dst_port = SCFlowTuple() + local p = packet.get() + timestring = p:timestring_legacy() + ip_version, src_ip, dst_ip, protocol, src_port, dst_port = p:tuple() file:write (timestring .. " " .. http_host .. " [**] " .. http_uri .. " [**] " .. http_ua .. " [**] " .. src_ip .. ":" .. src_port .. " -> " .. -- 2.47.2