Are you running the plugin as a remap plugin or not ?

If you are using the lua plugin in plugin.config, then the entry
functions are those that start with "do_global_"
If you are using it in the remap.config, then the entry function is do_remap()

Thanks.

Kit

On Sun, Nov 29, 2020 at 8:50 PM Lei Sun <[email protected]> wrote:
>
> Hi Guys,
>
> I'm trying to setup ATS with LUA. I started the server no problem, and didn't 
> see any issues loading the LUA plugin.
>
>> leisun@/usr/local/etc/trafficserver$ sudo traffic_server -T"ts_lua"
>> Traffic Server 10.0.0 Nov 29 2020 15:56:51 Leis-MacBook-Pro.local
>> traffic_server: using root directory '/usr/local'
>> [Nov 29 22:43:54.442]  DIAG: (ts_lua) [create_lua_vms] registered config 
>> string proxy.config.plugin.lua.max_states: with default [256]
>> [Nov 29 22:43:54.443]  DIAG: (ts_lua) [create_lua_vms] found 
>> proxy.config.plugin.lua.max_states: [256]
>
>
> However, as I was curling the server, and the ATS seems to be doing it's 
> proxy job fine, but I cannot see any logs coming out of the following LUA 
> script.
>>
>> function send_request()
>> local uri = ts.server_request.get_uri()
>> ts.debug(uri)
>> ts.note('send_request')
>> ts.error('send_request')
>> ts.warning('send_request')
>> end
>>
>> function do_remap()
>> ts.note('do_remap')
>> ts.error('do_remap')
>> ts.warning('do_remap')
>> ts.hook(TS_LUA_HOOK_SEND_REQUEST_HDR, send_request)
>> return 0
>> end
>
>
> I spent 2 full days searching online, and didn't get much luck.
>
> Could someone please let me know what I missed?
>
> PS - how do I get invited to the Slack channel please?
>
> Thank you so much!
> Lei
>

Reply via email to