Use lua script error with docs example


when i use docs lua script cause an error on my own test-machine.
my suricata build info with lua:

suricata --build-info|grep lua

LUA support: yes, through luajit
libluajit: yes

suricata version:

$ suricata -V
This is Suricata version 7.0.0-beta1 RELEASE

error outputs:

$ suricata -c /etc/suricata/suricata.yaml -T -vvv|grep lua
2/12/2022 – 10:41:15 - - luajit states preallocated: 128
2/12/2022 – 10:41:15 - - enabling script fast.lua
2/12/2022 – 10:41:15 - - enabling script test.lua
2/12/2022 – 10:41:15 - - [ERRCODE: SC_ERR_LUA_ERROR(212)] - failed to setup thread module
2/12/2022 – 10:41:15 - - [ERRCODE: SC_ERR_FATAL(171)] - Error during setup of lua output. Details should be described in previous error messages. Shutting down…

suricata.yaml about lua conf:

  • lua:
    # enabled: no
    enabled: yes #modified at 20220920
    scripts-dir: /etc/suricata/
    # - script1.lua
    - fast.lua
    - test.lua

fast.lua work well from : suricata/fast.lua at master · OISF/suricata · GitHub
and test.lua from 6.42. Lua Scripting for Detection — Suricata 7.0.0-rc1-dev documentation

how can i do to solve this error ?
thanks for your reading for my post!

The test.lua Lua script you have is not for Lua output, but for Lua matching via a rule. Such Lua scripts need to be referenced in a rule using the lua or luajit keywords.

See 16.1. Lua usage in Suricata — Suricata 6.0.9 documentation for the difference and 6.35. Lua Scripting — Suricata 6.0.9 documentation for more information about Lua matching.