Openlitespeed mod_lua

#1
Hi,

I compiled the mod_lua and set up all for openlitespeed, and im trying to run a lua script >that works on nginx<, as i read, the mod_lua uses excatly same commands as ngnix (you can use ngx.xxxxxxxx or ls.xxxxxxxxxxxx) should do same, however, it doesnt seem to work.

it gets loaded in a vconf file like this
include /www/server/total/ls_log.lua

but the error.log get filled with the intire file, starting from line 1 and forward...

Code:
2021-09-26 19:24:44.690756 [INFO] [PlainConf] [httpServerConfig:] start parsing file /www/server/total/ls_log.lua
2021-09-26 19:24:44.690759 [WARN] [PlainConf] [httpServerConfig:] parseline find block name [log_by_lua_block] is NOT keyword in /www/server/total/ls_log.lua:1
2021-09-26 19:24:44.690762 [WARN] [PlainConf] [httpServerConfig:] Not support [log_by_lua_block ] in file /www/server/total/ls_log.lua:1
2021-09-26 19:24:44.690764 [WARN] [PlainConf] [httpServerConfig:] Not support [local version = "1.5"] in file /www/server/total/ls_log.lua:2
2021-09-26 19:24:44.690767 [WARN] [PlainConf] [httpServerConfig:] Not support [-- local ok, app = pcall(require, "lsqlite3")] in file /www/server/total/ls_log.lua:3
2021-09-26 19:24:44.690770 [WARN] [PlainConf] [httpServerConfig:] Not support [local cpath = "/www/server/total/"] in file /www/server/total/ls_log.lua:4
2021-09-26 19:24:44.690772 [WARN] [PlainConf] [httpServerConfig:] Not support [if not package.cpath:find(cpath) then] in file /www/server/total/ls_log.lua:5
2021-09-26 19:24:44.690775 [WARN] [PlainConf] [httpServerConfig:] Not support [package.cpath = cpath .. "?.so;" .. package.cpath] in file /www/server/total/ls_log.lua:6
2021-09-26 19:24:44.690778 [WARN] [PlainConf] [httpServerConfig:] Not support [end ] in file /www/server/total/ls_log.lua:7
2021-09-26 19:24:44.690781 [WARN] [PlainConf] [httpServerConfig:] Not support [if not package.path:find(cpath) then] in file /www/server/total/ls_log.lua:8
2021-09-26 19:24:44.690784 [WARN] [PlainConf] [httpServerConfig:] Not support [package.path = cpath .. "?.lua;" .. package.path] in file /www/server/total/ls_log.lua:9
2021-09-26 19:24:44.690787 [WARN] [PlainConf] [httpServerConfig:] Not support [end ] in file /www/server/total/ls_log.lua:10
Ill just post those first lines here too, just fui..

Code:
log_by_lua_block {
    local version = "1.5"
    -- local ok, app = pcall(require, "lsqlite3")
    local cpath = "/www/server/total/"
    if not package.cpath:find(cpath) then
        package.cpath = cpath .. "?.so;" .. package.cpath
    end
    if not package.path:find(cpath) then
        package.path = cpath .. "?.lua;" .. package.path
    end
Im far from a lua scripting expert so of course i just hoped it would run out of the box, anyone have link to some working openlitespeed lua scripts i can see? and maybe a site with all the lua commands that works?
 
#3
First issue is probably the

parseline find block name [log_by_lua_block] is NOT keyword

Where does one set this keyword in openlitespeed and not nginx?
 
#4
where can i see what modules litespeed actually loaded?

I see this in error.log

2021-09-27 19:04:53.854684 [INFO] [PlainConf] [httpServerConfig:] module [cache] add param [privateexpireinseconds 3600]
2021-09-27 19:04:53.854686 [INFO] [PlainConf] [httpServerConfig:] module [mod_lua] add param [lib /usr/local/lib/libluajit.so]
2021-09-27 19:04:53.854898 [NOTICE] Loading LiteSpeed/1.7.14 Open
module versions:
modgzip 1.1
cache 1.62
modinspector 1.1
uploadprogress 1.1
mod_security 1.4
(built: Tue Sep 7 15:24:59 UTC 2021) ...
2021-09-27 19:04:53.854914 [NOTICE] Using [BoringSSL]

But i dont see mod_lua as loaded here, anywhere to check if its loaded?
 
Top