Skip to content

Commit 97be33b

Browse files
committed
doc/lua-output: fix example script for new apis
Ticket: OISF#7728
1 parent c5f9513 commit 97be33b

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

doc/userguide/output/lua-output.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ Example:
2929

3030
local config = require("suricata.config")
3131
local logger = require("suricata.log")
32+
local http = require("suricata.http")
33+
local packet = require("suricata.packet")
34+
local flow = require("suricata.flow")
3235

3336
function init (args)
3437
local needs = {}
@@ -44,26 +47,29 @@ Example:
4447
end
4548

4649
function log(args)
47-
http_uri = HttpGetRequestUriRaw()
50+
local tx = http:get_tx()
51+
52+
http_uri = tx:request_uri_raw()
4853
if http_uri == nil then
4954
http_uri = "<unknown>"
5055
end
5156
http_uri = string.gsub(http_uri, "%c", ".")
5257

53-
http_host = HttpGetRequestHost()
58+
http_host = tx:request_host()
5459
if http_host == nil then
5560
http_host = "<hostname unknown>"
5661
end
5762
http_host = string.gsub(http_host, "%c", ".")
5863

59-
http_ua = HttpGetRequestHeader("User-Agent")
64+
http_ua = tx:request_header("User-Agent")
6065
if http_ua == nil then
6166
http_ua = "<useragent unknown>"
6267
end
6368
http_ua = string.gsub(http_ua, "%g", ".")
6469

65-
timestring = SCPacketTimeString()
66-
ip_version, src_ip, dst_ip, protocol, src_port, dst_port = SCFlowTuple()
70+
local p = packet.get()
71+
timestring = p:timestring_legacy()
72+
ip_version, src_ip, dst_ip, protocol, src_port, dst_port = p:tuple()
6773

6874
file:write (timestring .. " " .. http_host .. " [**] " .. http_uri .. " [**] " ..
6975
http_ua .. " [**] " .. src_ip .. ":" .. src_port .. " -> " ..

0 commit comments

Comments
 (0)