Discussion:
How to use lua plugin and Scripts in Traffic server ?
Vasanth Mathivanan
2018-10-01 13:08:40 UTC
Permalink
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<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
Shu Kit Chan
2018-10-01 20:25:41 UTC
Permalink
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
Post by Vasanth Mathivanan
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
Vasanth Mathivanan
2018-10-03 05:48:48 UTC
Permalink
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 .



[***@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<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10



From: Shu Kit Chan<mailto:***@gmail.com>
Sent: Tuesday, October 2, 2018 1:55 AM
To: ***@trafficserver.apache.org<mailto:***@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
Post by Vasanth Mathivanan
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
Shu Kit Chan
2018-10-03 06:53:23 UTC
Permalink
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
Post by Vasanth Mathivanan
Hi Chan,
1.We had ATS 6.2 in Centos 6
# DO NOT EDIT - Generated for edge1 by Traffic Ops (https://x.x.x.x) on Wed May 30 09:22:41 EDT 2018
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 .
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
[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
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
Post by Vasanth Mathivanan
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
Vasanth Mathivanan
2018-10-03 07:14:32 UTC
Permalink
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:***@gmail.com>
Sent: Wednesday, October 3, 2018 12:23 PM
To: ***@trafficserver.apache.org<mailto:***@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
Post by Vasanth Mathivanan
Hi Chan,
1.We had ATS 6.2 in Centos 6
# DO NOT EDIT - Generated for edge1 by Traffic Ops (https://x.x.x.x) on Wed May 30 09:22:41 EDT 2018
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 .
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
[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
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
Post by Vasanth Mathivanan
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
Shu Kit Chan
2018-10-03 17:34:26 UTC
Permalink
You need to provide a full path to the lua script. e.g.

"@plugin=tslua.so @pparam=/tmp/cache.lua"

Thanks.

Kit

On Wed, Oct 3, 2018 at 12:16 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
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 for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 12:23 PM
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
Thanks.
Kit
On Tue, Oct 2, 2018 at 10:49 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Hi Chan,
1.We had ATS 6.2 in Centos 6
# DO NOT EDIT - Generated for edge1 by Traffic Ops (https://x.x.x.x) on Wed May 30 09:22:41 EDT 2018
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 .
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
[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
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
Post by Vasanth Mathivanan
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
Vasanth Mathivanan
2018-10-04 04:49:56 UTC
Permalink
Yes that I did but nothing to see any updates in diags.logs about lua plugin



Here the logs on below :

[Oct 3 21:41:09.405] Server {0x2ae65d787240} WARNING: connection throttle too high, 165585 (throttle) + 192 (internal use) > 165585 (file descriptor limit), using throttle of 165393

[Oct 3 21:41:09.405] Server {0x2ae65d787240} NOTE: cache clustering disabled

[Oct 3 21:41:09.437] Server {0x2ae65d787240} NOTE: ip_allow.config updated, reloading

[Oct 3 21:41:09.795] Server {0x2ae65d787240} NOTE: cache clustering disabled

[Oct 3 21:41:09.797] Server {0x2ae65d787240} NOTE: logging initialized[3], logging_mode = 3

[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/astats_over_http.so'

[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/regex_revalidate.so'

[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/remap_stats.so'

[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/stale_while_revalidate.so'

[Oct 3 21:41:09.800] Server {0x2ae65d787240} NOTE: loading SSL certificate configuration from /opt/trafficserver/etc/trafficserver/ssl_multicert.config

[Oct 3 21:41:09.961] Server {0x2ae664f1c700} NOTE: cache enabled

[Oct 3 21:41:10.042] Server {0x2ae65d787240} NOTE: traffic server running

[Oct 3 21:41:14.346] Server {0x2ae664100700} WARNING: failover: connection to DNS server 10.137.10.115 lost, move to 10.150.1.15



_Vasanth

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10



From: Shu Kit Chan<mailto:***@gmail.com>
Sent: Wednesday, October 3, 2018 11:04 PM
To: ***@trafficserver.apache.org<mailto:***@trafficserver.apache.org>
Subject: Re: How to use lua plugin and Scripts in Traffic server ?



You need to provide a full path to the lua script. e.g.

"@plugin=tslua.so @pparam=/tmp/cache.lua"

Thanks.

Kit

On Wed, Oct 3, 2018 at 12:16 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
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 for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 12:23 PM
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
Thanks.
Kit
On Tue, Oct 2, 2018 at 10:49 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Hi Chan,
1.We had ATS 6.2 in Centos 6
# DO NOT EDIT - Generated for edge1 by Traffic Ops (https://x.x.x.x) on Wed May 30 09:22:41 EDT 2018
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 .
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
[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
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
Post by Vasanth Mathivanan
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
Shu Kit Chan
2018-10-04 08:04:22 UTC
Permalink
You should use "ts.debug" instead of "print"

And turn on debug to see the message printed in traffic.out

Thanks.

Kit
On Wed, Oct 3, 2018 at 10:00 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Yes that I did but nothing to see any updates in diags.logs about lua plugin
[Oct 3 21:41:09.405] Server {0x2ae65d787240} WARNING: connection throttle too high, 165585 (throttle) + 192 (internal use) > 165585 (file descriptor limit), using throttle of 165393
[Oct 3 21:41:09.405] Server {0x2ae65d787240} NOTE: cache clustering disabled
[Oct 3 21:41:09.437] Server {0x2ae65d787240} NOTE: ip_allow.config updated, reloading
[Oct 3 21:41:09.795] Server {0x2ae65d787240} NOTE: cache clustering disabled
[Oct 3 21:41:09.797] Server {0x2ae65d787240} NOTE: logging initialized[3], logging_mode = 3
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/astats_over_http.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/regex_revalidate.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/remap_stats.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/stale_while_revalidate.so'
[Oct 3 21:41:09.800] Server {0x2ae65d787240} NOTE: loading SSL certificate configuration from /opt/trafficserver/etc/trafficserver/ssl_multicert.config
[Oct 3 21:41:09.961] Server {0x2ae664f1c700} NOTE: cache enabled
[Oct 3 21:41:10.042] Server {0x2ae65d787240} NOTE: traffic server running
[Oct 3 21:41:14.346] Server {0x2ae664100700} WARNING: failover: connection to DNS server 10.137.10.115 lost, move to 10.150.1.15
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 11:04 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You need to provide a full path to the lua script. e.g.
Thanks.
Kit
On Wed, Oct 3, 2018 at 12:16 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
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 for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 12:23 PM
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
Thanks.
Kit
On Tue, Oct 2, 2018 at 10:49 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Hi Chan,
1.We had ATS 6.2 in Centos 6
# DO NOT EDIT - Generated for edge1 by Traffic Ops (https://x.x.x.x) on Wed May 30 09:22:41 EDT 2018
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 .
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
[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
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
Post by Vasanth Mathivanan
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
Vasanth Mathivanan
2018-10-04 09:01:53 UTC
Permalink
I enabled diags debug log 0 to 1 in record.config, then it came looks like below while if I remove or hash the plugin in remap rule its happen same like that could not find the difference .





Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] age_value: 0

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] date_value: 1538643085

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] response_time: 1538643085

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] now: 1538643085

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] now (fixed): 1538643085

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] apparent_age: 0

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] corrected_received_age: 0

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] response_delay: 0

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] corrected_initial_age: 0

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] resident_time: 0

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] current_age: 0

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) [handle_content_length_header] RESPONSE cont len in hdr is 1680

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) [Squid code generation] Hit/Miss: 1, Log: 3, Hier: 2

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) Adding Server: ATS/6.2.3

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] State Transition: SM_ACTION_ORIGIN_SERVER_OPEN -> SM_ACTION_SERVER_READ {009}

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_smage) [6723] Incrementing Age. {010}

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) is_redirect_required 0

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) Setup Server Transfer

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] adding producer 'http server'

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] adding consumer 'user agent'

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] perform_cache_write_action CACHE_DO_NO_ACTION

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) tunnel_run started, p_arg is provided

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) tcp_init_cwnd_set 0

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) desired TCP congestion window is 0

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] [tunnel_run] producer already done

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] producer_handler [http server HTTP_TUNNEL_EVENT_PRECOMPLETE]

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::producer_handler] enable_redirection: [0 0 0] event: 2302

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler_server, HTTP_TUNNEL_EVENT_PRECOMPLETE]

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_ss) [6723] session closing, netvc 0x2aaab8015aa0

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] consumer_handler [user agent VC_EVENT_WRITE_COMPLETE]

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler_ua, VC_EVENT_WRITE_COMPLETE]

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) [1509] session closed

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [HttpSM::main_handler, HTTP_TUNNEL_EVENT_DONE]

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler, HTTP_TUNNEL_EVENT_DONE]

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::deallocate_postdata_copy_buffers]

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::deallocate_postdata_copy_buffers]

[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) [1509] session destroy





_Vasanth



Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10



From: Shu Kit Chan<mailto:***@gmail.com>
Sent: Thursday, October 4, 2018 1:34 PM
To: ***@trafficserver.apache.org<mailto:***@trafficserver.apache.org>
Subject: Re: How to use lua plugin and Scripts in Traffic server ?



You should use "ts.debug" instead of "print"

And turn on debug to see the message printed in traffic.out

Thanks.

Kit
On Wed, Oct 3, 2018 at 10:00 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Yes that I did but nothing to see any updates in diags.logs about lua plugin
[Oct 3 21:41:09.405] Server {0x2ae65d787240} WARNING: connection throttle too high, 165585 (throttle) + 192 (internal use) > 165585 (file descriptor limit), using throttle of 165393
[Oct 3 21:41:09.405] Server {0x2ae65d787240} NOTE: cache clustering disabled
[Oct 3 21:41:09.437] Server {0x2ae65d787240} NOTE: ip_allow.config updated, reloading
[Oct 3 21:41:09.795] Server {0x2ae65d787240} NOTE: cache clustering disabled
[Oct 3 21:41:09.797] Server {0x2ae65d787240} NOTE: logging initialized[3], logging_mode = 3
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/astats_over_http.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/regex_revalidate.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/remap_stats.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/stale_while_revalidate.so'
[Oct 3 21:41:09.800] Server {0x2ae65d787240} NOTE: loading SSL certificate configuration from /opt/trafficserver/etc/trafficserver/ssl_multicert.config
[Oct 3 21:41:09.961] Server {0x2ae664f1c700} NOTE: cache enabled
[Oct 3 21:41:10.042] Server {0x2ae65d787240} NOTE: traffic server running
[Oct 3 21:41:14.346] Server {0x2ae664100700} WARNING: failover: connection to DNS server 10.137.10.115 lost, move to 10.150.1.15
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 11:04 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You need to provide a full path to the lua script. e.g.
Thanks.
Kit
On Wed, Oct 3, 2018 at 12:16 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
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 for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 12:23 PM
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
Thanks.
Kit
On Tue, Oct 2, 2018 at 10:49 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Hi Chan,
1.We had ATS 6.2 in Centos 6
# DO NOT EDIT - Generated for edge1 by Traffic Ops (https://x.x.x.x) on Wed May 30 09:22:41 EDT 2018
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 .
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
[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
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
Post by Vasanth Mathivanan
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
Shu Kit Chan
2018-10-04 16:40:31 UTC
Permalink
You also need to set your debug tag appropriately when turning on debug.

https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html#proxy-config-diags-debug-tags

For lua plugin , you need to set the debug tags accordingly. e.g.

CONFIG proxy.config.diags.debug.tags STRING .*lua.*

inside records.config

Thanks.

Kit



On Thu, Oct 4, 2018 at 2:23 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
I enabled diags debug log 0 to 1 in record.config, then it came looks like below while if I remove or hash the plugin in remap rule its happen same like that could not find the difference .
Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] age_value: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] date_value: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] response_time: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] now: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] now (fixed): 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] apparent_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] corrected_received_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] response_delay: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] corrected_initial_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] resident_time: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] current_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) [handle_content_length_header] RESPONSE cont len in hdr is 1680
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) [Squid code generation] Hit/Miss: 1, Log: 3, Hier: 2
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) Adding Server: ATS/6.2.3
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] State Transition: SM_ACTION_ORIGIN_SERVER_OPEN -> SM_ACTION_SERVER_READ {009}
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_smage) [6723] Incrementing Age. {010}
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) is_redirect_required 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) Setup Server Transfer
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] adding producer 'http server'
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] adding consumer 'user agent'
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] perform_cache_write_action CACHE_DO_NO_ACTION
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) tunnel_run started, p_arg is provided
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) tcp_init_cwnd_set 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) desired TCP congestion window is 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] [tunnel_run] producer already done
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] producer_handler [http server HTTP_TUNNEL_EVENT_PRECOMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::producer_handler] enable_redirection: [0 0 0] event: 2302
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler_server, HTTP_TUNNEL_EVENT_PRECOMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_ss) [6723] session closing, netvc 0x2aaab8015aa0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] consumer_handler [user agent VC_EVENT_WRITE_COMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler_ua, VC_EVENT_WRITE_COMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) [1509] session closed
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [HttpSM::main_handler, HTTP_TUNNEL_EVENT_DONE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler, HTTP_TUNNEL_EVENT_DONE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::deallocate_postdata_copy_buffers]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::deallocate_postdata_copy_buffers]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) [1509] session destroy
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Thursday, October 4, 2018 1:34 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You should use "ts.debug" instead of "print"
And turn on debug to see the message printed in traffic.out
Thanks.
Kit
On Wed, Oct 3, 2018 at 10:00 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Yes that I did but nothing to see any updates in diags.logs about lua plugin
[Oct 3 21:41:09.405] Server {0x2ae65d787240} WARNING: connection throttle too high, 165585 (throttle) + 192 (internal use) > 165585 (file descriptor limit), using throttle of 165393
[Oct 3 21:41:09.405] Server {0x2ae65d787240} NOTE: cache clustering disabled
[Oct 3 21:41:09.437] Server {0x2ae65d787240} NOTE: ip_allow.config updated, reloading
[Oct 3 21:41:09.795] Server {0x2ae65d787240} NOTE: cache clustering disabled
[Oct 3 21:41:09.797] Server {0x2ae65d787240} NOTE: logging initialized[3], logging_mode = 3
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/astats_over_http.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/regex_revalidate.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/remap_stats.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/stale_while_revalidate.so'
[Oct 3 21:41:09.800] Server {0x2ae65d787240} NOTE: loading SSL certificate configuration from /opt/trafficserver/etc/trafficserver/ssl_multicert.config
[Oct 3 21:41:09.961] Server {0x2ae664f1c700} NOTE: cache enabled
[Oct 3 21:41:10.042] Server {0x2ae65d787240} NOTE: traffic server running
[Oct 3 21:41:14.346] Server {0x2ae664100700} WARNING: failover: connection to DNS server 10.137.10.115 lost, move to 10.150.1.15
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 11:04 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You need to provide a full path to the lua script. e.g.
Thanks.
Kit
On Wed, Oct 3, 2018 at 12:16 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
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 for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 12:23 PM
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
Thanks.
Kit
On Tue, Oct 2, 2018 at 10:49 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Hi Chan,
1.We had ATS 6.2 in Centos 6
# DO NOT EDIT - Generated for edge1 by Traffic Ops (https://x.x.x.x) on Wed May 30 09:22:41 EDT 2018
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 .
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
[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
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
Post by Vasanth Mathivanan
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
Vasanth Mathivanan
2018-10-05 07:38:43 UTC
Permalink
Now updated logs txn_hook_handler in logs .In this script had print ‘hit and not hit’ but didn’t came do where will check ? Every curl response its came looks like below :



[Oct 4 21:34:33.661] Server {0x2ae664202700} DIAG: (ts_lua) [TSRemapDoRemap] has txn hook -> adding txn close hook handler to release resources

[Oct 5 00:25:54.309] Server {0x2ae66470c700} DIAG: (ts_lua) [TSRemapDoRemap] has txn hook -> adding txn close hook handler to release resources



Curl Response:



[***@wow-den-stremer174 trafficserver]# curl -I x.x.x.x:8082

HTTP/1.1 403 Forbidden

Date: Fri, 05 Oct 2018 07:29:24 GMT

Server: ATS/6.2.3

Accept-Ranges: bytes

Access-Control-Allow-Origin: *

Content-Length: 3985

Content-Type: text/html; charset=UTF-8

Age: 0

Connection: keep-alive

Via: http/1.1 x.x..x.x(ApacheTrafficServer/6.2.3 [uScMs f p eN:t cCMi p sS])



_Vasanth

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10



From: Shu Kit Chan<mailto:***@gmail.com>
Sent: Thursday, October 4, 2018 10:19 PM
To: ***@trafficserver.apache.org<mailto:***@trafficserver.apache.org>
Subject: Re: How to use lua plugin and Scripts in Traffic server ?



You also need to set your debug tag appropriately when turning on debug.

https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html#proxy-config-diags-debug-tags

For lua plugin , you need to set the debug tags accordingly. e.g.

CONFIG proxy.config.diags.debug.tags STRING .*lua.*

inside records.config

Thanks.

Kit



On Thu, Oct 4, 2018 at 2:23 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
I enabled diags debug log 0 to 1 in record.config, then it came looks like below while if I remove or hash the plugin in remap rule its happen same like that could not find the difference .
Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] age_value: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] date_value: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] response_time: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] now: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] now (fixed): 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] apparent_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] corrected_received_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] response_delay: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] corrected_initial_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] resident_time: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] current_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) [handle_content_length_header] RESPONSE cont len in hdr is 1680
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) [Squid code generation] Hit/Miss: 1, Log: 3, Hier: 2
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) Adding Server: ATS/6.2.3
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] State Transition: SM_ACTION_ORIGIN_SERVER_OPEN -> SM_ACTION_SERVER_READ {009}
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_smage) [6723] Incrementing Age. {010}
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) is_redirect_required 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) Setup Server Transfer
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] adding producer 'http server'
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] adding consumer 'user agent'
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] perform_cache_write_action CACHE_DO_NO_ACTION
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) tunnel_run started, p_arg is provided
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) tcp_init_cwnd_set 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) desired TCP congestion window is 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] [tunnel_run] producer already done
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] producer_handler [http server HTTP_TUNNEL_EVENT_PRECOMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::producer_handler] enable_redirection: [0 0 0] event: 2302
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler_server, HTTP_TUNNEL_EVENT_PRECOMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_ss) [6723] session closing, netvc 0x2aaab8015aa0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] consumer_handler [user agent VC_EVENT_WRITE_COMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler_ua, VC_EVENT_WRITE_COMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) [1509] session closed
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [HttpSM::main_handler, HTTP_TUNNEL_EVENT_DONE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler, HTTP_TUNNEL_EVENT_DONE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::deallocate_postdata_copy_buffers]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::deallocate_postdata_copy_buffers]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) [1509] session destroy
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Thursday, October 4, 2018 1:34 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You should use "ts.debug" instead of "print"
And turn on debug to see the message printed in traffic.out
Thanks.
Kit
On Wed, Oct 3, 2018 at 10:00 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Yes that I did but nothing to see any updates in diags.logs about lua plugin
[Oct 3 21:41:09.405] Server {0x2ae65d787240} WARNING: connection throttle too high, 165585 (throttle) + 192 (internal use) > 165585 (file descriptor limit), using throttle of 165393
[Oct 3 21:41:09.405] Server {0x2ae65d787240} NOTE: cache clustering disabled
[Oct 3 21:41:09.437] Server {0x2ae65d787240} NOTE: ip_allow.config updated, reloading
[Oct 3 21:41:09.795] Server {0x2ae65d787240} NOTE: cache clustering disabled
[Oct 3 21:41:09.797] Server {0x2ae65d787240} NOTE: logging initialized[3], logging_mode = 3
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/astats_over_http.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/regex_revalidate.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/remap_stats.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/stale_while_revalidate.so'
[Oct 3 21:41:09.800] Server {0x2ae65d787240} NOTE: loading SSL certificate configuration from /opt/trafficserver/etc/trafficserver/ssl_multicert.config
[Oct 3 21:41:09.961] Server {0x2ae664f1c700} NOTE: cache enabled
[Oct 3 21:41:10.042] Server {0x2ae65d787240} NOTE: traffic server running
[Oct 3 21:41:14.346] Server {0x2ae664100700} WARNING: failover: connection to DNS server 10.137.10.115 lost, move to 10.150.1.15
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 11:04 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You need to provide a full path to the lua script. e.g.
Thanks.
Kit
On Wed, Oct 3, 2018 at 12:16 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
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 for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 12:23 PM
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
Thanks.
Kit
On Tue, Oct 2, 2018 at 10:49 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Hi Chan,
1.We had ATS 6.2 in Centos 6
# DO NOT EDIT - Generated for edge1 by Traffic Ops (https://x.x.x.x) on Wed May 30 09:22:41 EDT 2018
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 .
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
[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
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
Post by Vasanth Mathivanan
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
Shu Kit Chan
2018-10-05 08:43:10 UTC
Permalink
Are you still using print ? Please use ts.debug instead .

if cache_status == TS_LUA_CACHE_LOOKUP_HIT_FRESH then

ts.debug('hit')

else

ts.debug('not hit')

end

Thanks.
Kit
On Fri, Oct 5, 2018 at 12:49 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
[Oct 4 21:34:33.661] Server {0x2ae664202700} DIAG: (ts_lua) [TSRemapDoRemap] has txn hook -> adding txn close hook handler to release resources
[Oct 5 00:25:54.309] Server {0x2ae66470c700} DIAG: (ts_lua) [TSRemapDoRemap] has txn hook -> adding txn close hook handler to release resources
HTTP/1.1 403 Forbidden
Date: Fri, 05 Oct 2018 07:29:24 GMT
Server: ATS/6.2.3
Accept-Ranges: bytes
Access-Control-Allow-Origin: *
Content-Length: 3985
Content-Type: text/html; charset=UTF-8
Age: 0
Connection: keep-alive
Via: http/1.1 x.x..x.x(ApacheTrafficServer/6.2.3 [uScMs f p eN:t cCMi p sS])
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Thursday, October 4, 2018 10:19 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You also need to set your debug tag appropriately when turning on debug.
https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html#proxy-config-diags-debug-tags
For lua plugin , you need to set the debug tags accordingly. e.g.
CONFIG proxy.config.diags.debug.tags STRING .*lua.*
inside records.config
Thanks.
Kit
On Thu, Oct 4, 2018 at 2:23 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
I enabled diags debug log 0 to 1 in record.config, then it came looks like below while if I remove or hash the plugin in remap rule its happen same like that could not find the difference .
Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] age_value: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] date_value: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] response_time: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] now: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] now (fixed): 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] apparent_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] corrected_received_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] response_delay: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] corrected_initial_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] resident_time: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] current_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) [handle_content_length_header] RESPONSE cont len in hdr is 1680
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) [Squid code generation] Hit/Miss: 1, Log: 3, Hier: 2
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) Adding Server: ATS/6.2.3
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] State Transition: SM_ACTION_ORIGIN_SERVER_OPEN -> SM_ACTION_SERVER_READ {009}
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_smage) [6723] Incrementing Age. {010}
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) is_redirect_required 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) Setup Server Transfer
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] adding producer 'http server'
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] adding consumer 'user agent'
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] perform_cache_write_action CACHE_DO_NO_ACTION
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) tunnel_run started, p_arg is provided
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) tcp_init_cwnd_set 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) desired TCP congestion window is 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] [tunnel_run] producer already done
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] producer_handler [http server HTTP_TUNNEL_EVENT_PRECOMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::producer_handler] enable_redirection: [0 0 0] event: 2302
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler_server, HTTP_TUNNEL_EVENT_PRECOMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_ss) [6723] session closing, netvc 0x2aaab8015aa0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] consumer_handler [user agent VC_EVENT_WRITE_COMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler_ua, VC_EVENT_WRITE_COMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) [1509] session closed
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [HttpSM::main_handler, HTTP_TUNNEL_EVENT_DONE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler, HTTP_TUNNEL_EVENT_DONE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::deallocate_postdata_copy_buffers]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::deallocate_postdata_copy_buffers]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) [1509] session destroy
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Thursday, October 4, 2018 1:34 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You should use "ts.debug" instead of "print"
And turn on debug to see the message printed in traffic.out
Thanks.
Kit
On Wed, Oct 3, 2018 at 10:00 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Yes that I did but nothing to see any updates in diags.logs about lua plugin
[Oct 3 21:41:09.405] Server {0x2ae65d787240} WARNING: connection throttle too high, 165585 (throttle) + 192 (internal use) > 165585 (file descriptor limit), using throttle of 165393
[Oct 3 21:41:09.405] Server {0x2ae65d787240} NOTE: cache clustering disabled
[Oct 3 21:41:09.437] Server {0x2ae65d787240} NOTE: ip_allow.config updated, reloading
[Oct 3 21:41:09.795] Server {0x2ae65d787240} NOTE: cache clustering disabled
[Oct 3 21:41:09.797] Server {0x2ae65d787240} NOTE: logging initialized[3], logging_mode = 3
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/astats_over_http.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/regex_revalidate.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/remap_stats.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/stale_while_revalidate.so'
[Oct 3 21:41:09.800] Server {0x2ae65d787240} NOTE: loading SSL certificate configuration from /opt/trafficserver/etc/trafficserver/ssl_multicert.config
[Oct 3 21:41:09.961] Server {0x2ae664f1c700} NOTE: cache enabled
[Oct 3 21:41:10.042] Server {0x2ae65d787240} NOTE: traffic server running
[Oct 3 21:41:14.346] Server {0x2ae664100700} WARNING: failover: connection to DNS server 10.137.10.115 lost, move to 10.150.1.15
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 11:04 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You need to provide a full path to the lua script. e.g.
Thanks.
Kit
On Wed, Oct 3, 2018 at 12:16 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
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 for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 12:23 PM
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
Thanks.
Kit
On Tue, Oct 2, 2018 at 10:49 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Hi Chan,
1.We had ATS 6.2 in Centos 6
# DO NOT EDIT - Generated for edge1 by Traffic Ops (https://x.x.x.x) on Wed May 30 09:22:41 EDT 2018
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 .
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
[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
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
Post by Vasanth Mathivanan
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
Vasanth Mathivanan
2018-10-05 09:03:25 UTC
Permalink
Sorry I forget Now changed the ts.debug in script ,but came same log no changes on It .





_Vasanth







Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10



From: Shu Kit Chan<mailto:***@gmail.com>
Sent: Friday, October 5, 2018 2:25 PM
To: ***@trafficserver.apache.org<mailto:***@trafficserver.apache.org>
Subject: Re: How to use lua plugin and Scripts in Traffic server ?



Are you still using print ? Please use ts.debug instead .

if cache_status == TS_LUA_CACHE_LOOKUP_HIT_FRESH then

ts.debug('hit')

else

ts.debug('not hit')

end

Thanks.
Kit
On Fri, Oct 5, 2018 at 12:49 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
[Oct 4 21:34:33.661] Server {0x2ae664202700} DIAG: (ts_lua) [TSRemapDoRemap] has txn hook -> adding txn close hook handler to release resources
[Oct 5 00:25:54.309] Server {0x2ae66470c700} DIAG: (ts_lua) [TSRemapDoRemap] has txn hook -> adding txn close hook handler to release resources
HTTP/1.1 403 Forbidden
Date: Fri, 05 Oct 2018 07:29:24 GMT
Server: ATS/6.2.3
Accept-Ranges: bytes
Access-Control-Allow-Origin: *
Content-Length: 3985
Content-Type: text/html; charset=UTF-8
Age: 0
Connection: keep-alive
Via: http/1.1 x.x..x.x(ApacheTrafficServer/6.2.3 [uScMs f p eN:t cCMi p sS])
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Thursday, October 4, 2018 10:19 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You also need to set your debug tag appropriately when turning on debug.
https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html#proxy-config-diags-debug-tags
For lua plugin , you need to set the debug tags accordingly. e.g.
CONFIG proxy.config.diags.debug.tags STRING .*lua.*
inside records.config
Thanks.
Kit
On Thu, Oct 4, 2018 at 2:23 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
I enabled diags debug log 0 to 1 in record.config, then it came looks like below while if I remove or hash the plugin in remap rule its happen same like that could not find the difference .
Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] age_value: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] date_value: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] response_time: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] now: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] now (fixed): 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] apparent_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] corrected_received_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] response_delay: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] corrected_initial_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] resident_time: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] current_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) [handle_content_length_header] RESPONSE cont len in hdr is 1680
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) [Squid code generation] Hit/Miss: 1, Log: 3, Hier: 2
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) Adding Server: ATS/6.2.3
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] State Transition: SM_ACTION_ORIGIN_SERVER_OPEN -> SM_ACTION_SERVER_READ {009}
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_smage) [6723] Incrementing Age. {010}
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) is_redirect_required 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) Setup Server Transfer
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] adding producer 'http server'
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] adding consumer 'user agent'
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] perform_cache_write_action CACHE_DO_NO_ACTION
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) tunnel_run started, p_arg is provided
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) tcp_init_cwnd_set 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) desired TCP congestion window is 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] [tunnel_run] producer already done
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] producer_handler [http server HTTP_TUNNEL_EVENT_PRECOMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::producer_handler] enable_redirection: [0 0 0] event: 2302
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler_server, HTTP_TUNNEL_EVENT_PRECOMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_ss) [6723] session closing, netvc 0x2aaab8015aa0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] consumer_handler [user agent VC_EVENT_WRITE_COMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler_ua, VC_EVENT_WRITE_COMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) [1509] session closed
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [HttpSM::main_handler, HTTP_TUNNEL_EVENT_DONE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler, HTTP_TUNNEL_EVENT_DONE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::deallocate_postdata_copy_buffers]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::deallocate_postdata_copy_buffers]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) [1509] session destroy
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Thursday, October 4, 2018 1:34 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You should use "ts.debug" instead of "print"
And turn on debug to see the message printed in traffic.out
Thanks.
Kit
On Wed, Oct 3, 2018 at 10:00 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Yes that I did but nothing to see any updates in diags.logs about lua plugin
[Oct 3 21:41:09.405] Server {0x2ae65d787240} WARNING: connection throttle too high, 165585 (throttle) + 192 (internal use) > 165585 (file descriptor limit), using throttle of 165393
[Oct 3 21:41:09.405] Server {0x2ae65d787240} NOTE: cache clustering disabled
[Oct 3 21:41:09.437] Server {0x2ae65d787240} NOTE: ip_allow.config updated, reloading
[Oct 3 21:41:09.795] Server {0x2ae65d787240} NOTE: cache clustering disabled
[Oct 3 21:41:09.797] Server {0x2ae65d787240} NOTE: logging initialized[3], logging_mode = 3
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/astats_over_http.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/regex_revalidate.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/remap_stats.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/stale_while_revalidate.so'
[Oct 3 21:41:09.800] Server {0x2ae65d787240} NOTE: loading SSL certificate configuration from /opt/trafficserver/etc/trafficserver/ssl_multicert.config
[Oct 3 21:41:09.961] Server {0x2ae664f1c700} NOTE: cache enabled
[Oct 3 21:41:10.042] Server {0x2ae65d787240} NOTE: traffic server running
[Oct 3 21:41:14.346] Server {0x2ae664100700} WARNING: failover: connection to DNS server 10.137.10.115 lost, move to 10.150.1.15
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 11:04 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You need to provide a full path to the lua script. e.g.
Thanks.
Kit
On Wed, Oct 3, 2018 at 12:16 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
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 for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 12:23 PM
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
Thanks.
Kit
On Tue, Oct 2, 2018 at 10:49 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Hi Chan,
1.We had ATS 6.2 in Centos 6
# DO NOT EDIT - Generated for edge1 by Traffic Ops (https://x.x.x.x) on Wed May 30 09:22:41 EDT 2018
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 .
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
[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
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
Post by Vasanth Mathivanan
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
Vasanth Mathivanan
2018-10-05 11:52:39 UTC
Permalink
Thanks for your support Chan.
Here logs are came its had issue on traffic_server service not proper reload, now its fine.

[Oct 5 04:42:04.198] Server {0x2ae665324700} DIAG: (ts_lua) hit
[Oct 5 04:42:04.198] Server {0x2ae665426700} DIAG: (ts_lua) [TSRemapDoRemap] has txn hook -> adding txn close hook handler to release resources
[Oct 5 04:42:04.198] Server {0x2ae665426700} DIAG: (ts_lua) [TSRemapDoRemap] has txn hook -> adding txn close hook handler to release resources
[Oct 5 04:42:04.198] Server {0x2ae665426700} DIAG: (ts_lua) not hit


_Vasanth
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

From: Vasanth Mathivanan<mailto:***@evolutiondigital.com>
Sent: Friday, October 5, 2018 2:33 PM
To: ***@trafficserver.apache.org<mailto:***@trafficserver.apache.org>
Subject: RE: How to use lua plugin and Scripts in Traffic server ?


Sorry I forget Now changed the ts.debug in script ,but came same log no changes on It .





_Vasanth







Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10



From: Shu Kit Chan<mailto:***@gmail.com>
Sent: Friday, October 5, 2018 2:25 PM
To: ***@trafficserver.apache.org<mailto:***@trafficserver.apache.org>
Subject: Re: How to use lua plugin and Scripts in Traffic server ?



Are you still using print ? Please use ts.debug instead .

if cache_status == TS_LUA_CACHE_LOOKUP_HIT_FRESH then

ts.debug('hit')

else

ts.debug('not hit')

end

Thanks.
Kit
On Fri, Oct 5, 2018 at 12:49 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
[Oct 4 21:34:33.661] Server {0x2ae664202700} DIAG: (ts_lua) [TSRemapDoRemap] has txn hook -> adding txn close hook handler to release resources
[Oct 5 00:25:54.309] Server {0x2ae66470c700} DIAG: (ts_lua) [TSRemapDoRemap] has txn hook -> adding txn close hook handler to release resources
HTTP/1.1 403 Forbidden
Date: Fri, 05 Oct 2018 07:29:24 GMT
Server: ATS/6.2.3
Accept-Ranges: bytes
Access-Control-Allow-Origin: *
Content-Length: 3985
Content-Type: text/html; charset=UTF-8
Age: 0
Connection: keep-alive
Via: http/1.1 x.x..x.x(ApacheTrafficServer/6.2.3 [uScMs f p eN:t cCMi p sS])
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Thursday, October 4, 2018 10:19 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You also need to set your debug tag appropriately when turning on debug.
https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html#proxy-config-diags-debug-tags
For lua plugin , you need to set the debug tags accordingly. e.g.
CONFIG proxy.config.diags.debug.tags STRING .*lua.*
inside records.config
Thanks.
Kit
On Thu, Oct 4, 2018 at 2:23 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
I enabled diags debug log 0 to 1 in record.config, then it came looks like below while if I remove or hash the plugin in remap rule its happen same like that could not find the difference .
Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] age_value: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] date_value: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] response_time: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] now: 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] now (fixed): 1538643085
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] apparent_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] corrected_received_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] response_delay: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] corrected_initial_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] resident_time: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_age) [calculate_document_age] current_age: 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) [handle_content_length_header] RESPONSE cont len in hdr is 1680
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) [Squid code generation] Hit/Miss: 1, Log: 3, Hier: 2
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_trans) Adding Server: ATS/6.2.3
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] State Transition: SM_ACTION_ORIGIN_SERVER_OPEN -> SM_ACTION_SERVER_READ {009}
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_smage) [6723] Incrementing Age. {010}
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) is_redirect_required 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) Setup Server Transfer
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] adding producer 'http server'
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] adding consumer 'user agent'
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] perform_cache_write_action CACHE_DO_NO_ACTION
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) tunnel_run started, p_arg is provided
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) tcp_init_cwnd_set 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) desired TCP congestion window is 0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] [tunnel_run] producer already done
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] producer_handler [http server HTTP_TUNNEL_EVENT_PRECOMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::producer_handler] enable_redirection: [0 0 0] event: 2302
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler_server, HTTP_TUNNEL_EVENT_PRECOMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_ss) [6723] session closing, netvc 0x2aaab8015aa0
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_tunnel) [6723] consumer_handler [user agent VC_EVENT_WRITE_COMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler_ua, VC_EVENT_WRITE_COMPLETE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) [1509] session closed
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [HttpSM::main_handler, HTTP_TUNNEL_EVENT_DONE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http) [6723] [&HttpSM::tunnel_handler, HTTP_TUNNEL_EVENT_DONE]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::deallocate_postdata_copy_buffers]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_redirect) [HttpTunnel::deallocate_postdata_copy_buffers]
[Oct 4 01:51:25.426] Server {0x2ae66480e700} DEBUG: (http_cs) [1509] session destroy
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Thursday, October 4, 2018 1:34 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You should use "ts.debug" instead of "print"
And turn on debug to see the message printed in traffic.out
Thanks.
Kit
On Wed, Oct 3, 2018 at 10:00 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Yes that I did but nothing to see any updates in diags.logs about lua plugin
[Oct 3 21:41:09.405] Server {0x2ae65d787240} WARNING: connection throttle too high, 165585 (throttle) + 192 (internal use) > 165585 (file descriptor limit), using throttle of 165393
[Oct 3 21:41:09.405] Server {0x2ae65d787240} NOTE: cache clustering disabled
[Oct 3 21:41:09.437] Server {0x2ae65d787240} NOTE: ip_allow.config updated, reloading
[Oct 3 21:41:09.795] Server {0x2ae65d787240} NOTE: cache clustering disabled
[Oct 3 21:41:09.797] Server {0x2ae65d787240} NOTE: logging initialized[3], logging_mode = 3
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/astats_over_http.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/regex_revalidate.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/remap_stats.so'
[Oct 3 21:41:09.798] Server {0x2ae65d787240} NOTE: loading plugin '/opt/trafficserver/libexec/trafficserver/stale_while_revalidate.so'
[Oct 3 21:41:09.800] Server {0x2ae65d787240} NOTE: loading SSL certificate configuration from /opt/trafficserver/etc/trafficserver/ssl_multicert.config
[Oct 3 21:41:09.961] Server {0x2ae664f1c700} NOTE: cache enabled
[Oct 3 21:41:10.042] Server {0x2ae65d787240} NOTE: traffic server running
[Oct 3 21:41:14.346] Server {0x2ae664100700} WARNING: failover: connection to DNS server 10.137.10.115 lost, move to 10.150.1.15
_Vasanth
Sent from Mail for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 11:04 PM
Subject: Re: How to use lua plugin and Scripts in Traffic server ?
You need to provide a full path to the lua script. e.g.
Thanks.
Kit
On Wed, Oct 3, 2018 at 12:16 AM Vasanth Mathivanan
Post by Vasanth Mathivanan
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 for Windows 10
From: Shu Kit Chan
Sent: Wednesday, October 3, 2018 12:23 PM
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
Thanks.
Kit
On Tue, Oct 2, 2018 at 10:49 PM Vasanth Mathivanan
Post by Vasanth Mathivanan
Hi Chan,
1.We had ATS 6.2 in Centos 6
# DO NOT EDIT - Generated for edge1 by Traffic Ops (https://x.x.x.x) on Wed May 30 09:22:41 EDT 2018
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 .
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
[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
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
Post by Vasanth Mathivanan
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
Loading...