Now It accessible the plugin but have some script issue [Oct 3 00:06:29.598] Server {0x2aaabed91700} ERROR: [ReverseProxy] failed to add remap rule at /opt/trafficserver/etc/trafficserver/remap.config line 2: Failed to create instance for plugin "/opt/trafficserver/libexec/trafficserver/tslua.so": [ts_lua_add_module] luaL_loadstring failed: [string "cache.lua"]:1: '=' expected near '<eof>'
[Oct 3 00:06:29.598] Server {0x2aaabed91700} WARNING: something failed during BuildTable() -- check your remap plugins! [Oct 3 00:06:29.598] Server {0x2aaabed91700} WARNING: failed to reload remap.config, not replacing! _ Vasanth Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 From: Shu Kit Chan<mailto:chanshu...@gmail.com> Sent: Wednesday, October 3, 2018 12:23 PM To: users@trafficserver.apache.org<mailto:users@trafficserver.apache.org> Subject: Re: How to use lua plugin and Scripts in Traffic server ? It looks like the lua plugin cannot find your lua script. I think you should not be using "@@pparam" . Instead can you try just using "@pparam" ? Thanks. Kit On Tue, Oct 2, 2018 at 10:49 PM Vasanth Mathivanan <vasant...@evolutiondigital.com> wrote: > > Hi Chan, > > > > 1.We had ATS 6.2 in Centos 6 > > > > 2.Remap rules looks like below : > > # DO NOT EDIT - Generated for edge1 by Traffic Ops (https://x.x.x.x) on > Wed May 30 09:22:41 EDT 2018 > > map http://x.x.x.x:8082/ http://x.x.x.x/ @plugin=header_rewrite.so > @pparam=dscp/set_dscp_32.config @plugin=header_rewrite.so > @pparam=hdr_rw_live.config @plugin=background_fetch.so > @pparam=bg_fetch.config @plugin=collapsed_forwarding.so @plugin=tslua.so > @@pparam=lua_test.lua > > map http://x.x.x.x:8082/ http://x.x.x.x/ @plugin=header_rewrite.so > @pparam=dscp/set_dscp_0.config @plugin=background_fetch.so > @pparam=bg_fetch.config @plugin=collapsed_forwarding.so @plugin=tslua.so > @@pparam=lua_test.lua > > > > note: I tried to given entire path in @@pparm syntax like > @@pparam=/opt/trafficserver/libexec/trafficserver/test_lua.lua > > > > > > 3.Lua Script looks like : > > > > function cache_lookup() > > local cache_status = ts.http.get_cache_lookup_status() > > if cache_status == TS_LUA_CACHE_LOOKUP_HIT_FRESH then > > print('hit') > > else > > print('not hit') > > end > > ts.http.set_cache_lookup_status(TS_LUA_CACHE_LOOKUP_MISS) > > end > > > > function do_remap() > > ts.hook(TS_LUA_HOOK_CACHE_LOOKUP_COMPLETE, cache_lookup) > > return 0 > > end > > > > 4.yes I did curl method only . > > > > [root@wow-den-stremer174 ~]# curl -I x.x.x.x:8082 > > TTP/1.1 404 Not Found on Accelerator > > Date: Wed, 03 Oct 2018 05:13:23 GMT > > Connection: keep-alive > > Via: http/1.1 x.x.x.x. (ApacheTrafficServer/6.2.3 [uSc s f p eS:tNc i p s ]) > > Server: ATS/6.2.3 > > Cache-Control: no-store > > Content-Type: text/html > > Content-Language: en > > Content-Length: 297 > > > > 5.Diags log: > > > > > > [Oct 2 22:38:33.537] Server {0x2b25ed7fd240} ERROR: [ReverseProxy] failed to > add remap rule at /opt/trafficserver/etc/trafficserver/remap.config line 2: > Failed to create instance for plugin > "/opt/trafficserver/libexec/trafficserver/tslua.so": [TSRemapNewInstance] - > lua script file or string is required !! > > > > > > Note : traffic.out and error.log nothing to do . > > > > -Vasanth > > > > Sent from Mail for Windows 10 > > > > From: Shu Kit Chan > Sent: Tuesday, October 2, 2018 1:55 AM > To: users@trafficserver.apache.org > Subject: Re: How to use lua plugin and Scripts in Traffic server ? > > > > A few things > > 1) What version of ATS are you on? 5.3.x ? > 2) Can you show how your remap rules looks like? > 3) you use the example lua script? if not, what is written in your script? > 4) how do you test that? curl a url that goes against your machine? > 5) Any messages in traffic.out / error.log / diags.log that is of interest ? > > Thanks. > > Kit > On Mon, Oct 1, 2018 at 6:08 AM Vasanth Mathivanan > <vasant...@evolutiondigital.com> wrote: > > > > > > > > Hi, > > > > > > > > As per document I saw lot of examples in this > > https://docs.trafficserver.apache.org/en/5.3.x/reference/plugins/ts_lua.en.html#ts-lua-plugin > > I did the remap config changes ( plugin and parameters ) then make a > > script file in some path and pointed on remap Config .There is no > > response on it . > > > > How I could use in traffic server and also test them ? > > > > > > > > -Vasanth > > > > > > > > Sent from Mail for Windows 10 > > > >