From users-return-7250-apmail-trafficserver-users-archive=trafficserver.apache.org@trafficserver.apache.org Thu Oct 4 08:04:24 2018 Return-Path: X-Original-To: apmail-trafficserver-users-archive@www.apache.org Delivered-To: apmail-trafficserver-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 984E9208CC for ; Thu, 4 Oct 2018 08:04:24 +0000 (UTC) Received: (qmail 33778 invoked by uid 500); 4 Oct 2018 08:04:24 -0000 Delivered-To: apmail-trafficserver-users-archive@trafficserver.apache.org Received: (qmail 33708 invoked by uid 500); 4 Oct 2018 08:04:24 -0000 Mailing-List: contact users-help@trafficserver.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@trafficserver.apache.org Delivered-To: mailing list users@trafficserver.apache.org Received: (qmail 33698 invoked by uid 99); 4 Oct 2018 08:04:24 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Oct 2018 08:04:24 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id A98FE1A044F for ; Thu, 4 Oct 2018 08:04:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.111 X-Spam-Level: X-Spam-Status: No, score=-0.111 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_DKIMWL_WL_MED=-0.01] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id kpe1ZOSYBsFA for ; Thu, 4 Oct 2018 08:04:22 +0000 (UTC) Received: from mail-it1-f174.google.com (mail-it1-f174.google.com [209.85.166.174]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id C692F5F3EE for ; Thu, 4 Oct 2018 08:04:21 +0000 (UTC) Received: by mail-it1-f174.google.com with SMTP id l127-v6so1253662ith.1 for ; Thu, 04 Oct 2018 01:04:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=0wmwZ7NBrLYHLV2glrz2KAhpNN+9wkgYjIMfe7getxE=; b=KHdEiug0ObZF2lpPj004uBbJqErgAy9B53O69x+Pn/vPAInG7oWgToPYf0JWbzxC6t 865AD03f4qyLqZ2tVOG4/aSGoxEz2CrXmTam1ZRDO7pdDN99QgOYg3J1XmTVomxdwmqQ LdFwpN73UFv/XyzRzkYPpSSMy+L5UJqK88kEj3sK/MEvWZ3Dqy05ZIpj3CHeHlMmHgfb YK9mBEfxRh+rof15VVfulusL3Wzz/E6gwSz0CKhASnmbBg0Suhylc0bfFXOIXi/xtpMT yQ4zPeMgw7VKeb+dIoIyX2wMBxtyDczJ4OOCyQgYNUUJZiSWqjjQie6bHMzqPJlTpqrD J4ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=0wmwZ7NBrLYHLV2glrz2KAhpNN+9wkgYjIMfe7getxE=; b=J3lo4VHX0XckiPf0EugtkG+bYAWk6miYygy4r1zqD9M4ljyxH3lcon/a14mIQblTYE DMddq/BIbLPDB0gkGSHNiwy65Ob5ivWrxu2Z6vR31eX0EXSsS9FkFoTQ1o2rsUfNY0x3 r2ImWjessofxwd3VucjyAiYR+vgpwCa38ViZ9Da5gwf/ekB8QeJYiaOLKhNg6zMKf0i5 JU1SYYjHO9f74cMnpVtVblvC1hZOOEynAxBTl68eLeh/u48tE0iofB0CCu6uR6qv+0oj 5INT6qfVhbKj7hVYoEIiAc12Vvt/J+MBekDslqSOeO/rKKmYAOi3a+/rq5shWzqP2wK5 8oog== X-Gm-Message-State: ABuFfogoHl0tW5KsIoMVFKJM4k5hOahbMEYkHrzYUtAa9g6QClKlBrvy WpeZaw2PnhaJStXyS0A3BUBP237TmkWkBAth+BlYGQ== X-Google-Smtp-Source: ACcGV617QbwBzpycErRNu+bXKrxja8mQgO6TfRRcvtttjgVPKd1VT6LSBJPJFF/TSwX1SmjkML0rM/rIxJfm2SF5BLw= X-Received: by 2002:a24:5f15:: with SMTP id r21-v6mr3933530itb.6.1538640260898; Thu, 04 Oct 2018 01:04:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Shu Kit Chan Date: Thu, 4 Oct 2018 01:04:22 -0700 Message-ID: Subject: Re: How to use lua plugin and Scripts in Traffic server ? To: users@trafficserver.apache.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 wrote: > > Yes that I did but nothing to see any updates in diags.logs about lua plu= gin > > > > Here the logs on below : > > [Oct 3 21:41:09.405] Server {0x2ae65d787240} WARNING: connection throttl= e too high, 165585 (throttle) + 192 (internal use) > 165585 (file descripto= r limit), using throttle of 165393 > > [Oct 3 21:41:09.405] Server {0x2ae65d787240} NOTE: cache clustering disa= bled > > [Oct 3 21:41:09.437] Server {0x2ae65d787240} NOTE: ip_allow.config updat= ed, reloading > > [Oct 3 21:41:09.795] Server {0x2ae65d787240} NOTE: cache clustering disa= bled > > [Oct 3 21:41:09.797] Server {0x2ae65d787240} NOTE: logging initialized[3= ], logging_mode =3D 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 certifica= te configuration from /opt/trafficserver/etc/trafficserver/ssl_multicert.co= nfig > > [Oct 3 21:41:09.961] Server {0x2ae664f1c700} NOTE: cache enabled > > [Oct 3 21:41:10.042] Server {0x2ae65d787240} NOTE: traffic server runnin= g > > [Oct 3 21:41:14.346] Server {0x2ae664100700} WARNING: failover: connecti= on 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 > To: users@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=3Dtslua.so @pparam=3D/tmp/cache.lua" > > Thanks. > > Kit > > On Wed, Oct 3, 2018 at 12:16 AM Vasanth Mathivanan > wrote: > > > > Now It accessible the plugin but have some script issue > > > > [Oct 3 00:06:29.598] Server {0x2aaabed91700} ERROR: [ReverseProxy] fai= led to add remap rule at /opt/trafficserver/etc/trafficserver/remap.config = line 2: Failed to create instance for plugin "/opt/trafficserver/libexec/tr= afficserver/tslua.so": [ts_lua_add_module] luaL_loadstring failed: [string= "cache.lua"]:1: '=3D' expected near '' > > > > [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 > > To: 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 > > 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=3Dheader_r= ewrite.so @pparam=3Ddscp/set_dscp_32.config @plugin=3Dheader_rewrite.so @pp= aram=3Dhdr_rw_live.config @plugin=3Dbackground_fetch.so @pparam=3Dbg_fetch.= config @plugin=3Dcollapsed_forwarding.so @plugin=3Dtslua.so @@pparam=3Dlua= _test.lua > > > > > > map http://x.x.x.x:8082/ http://x.x.x.x/ @plugin=3Dheader_r= ewrite.so @pparam=3Ddscp/set_dscp_0.config @plugin=3Dbackground_fetch.so @p= param=3Dbg_fetch.config @plugin=3Dcollapsed_forwarding.so @plugin=3Dtslua.s= o @@pparam=3Dlua_test.lua > > > > > > > > > > > > note: I tried to given entire path in @@pparm syntax like @@pparam=3D= /opt/trafficserver/libexec/trafficserver/test_lua.lua > > > > > > > > > > > > > > > > > > 3.Lua Script looks like : > > > > > > > > > > > > function cache_lookup() > > > > > > local cache_status =3D ts.http.get_cache_lookup_status() > > > > > > if cache_status =3D=3D 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] f= ailed to add remap rule at /opt/trafficserver/etc/trafficserver/remap.confi= g line 2: Failed to create instance for plugin "/opt/trafficserver/libexec/= trafficserver/tslua.so": [TSRemapNewInstance] - lua script file or string i= s 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 sc= ript? > > > 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 int= erest ? > > > > > > Thanks. > > > > > > Kit > > > On Mon, Oct 1, 2018 at 6:08 AM Vasanth Mathivanan > > > wrote: > > > > > > > > > > > > > > > > Hi, > > > > > > > > > > > > > > > > As per document I saw lot of examples in this https://docs.traffics= erver.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 scri= pt 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 > > > > > > > >