Hi, It is generating " WARNING: Can't acquire lockfile '/usr/local/trafficserver/var/trafficserver/server.lock' (Lock file held by process ID 17952) " warning when I execute " sudo $PREFIX/bin/traffic_server -T debug-hello" this.
Also tell me how can we categories http header request user agents. Since ATS receives request from different user agents and keeps a copy in cache for each UA, that mean for a single url I have multiple copies on the basis of user agents. Kindly tell me is there any mechanism to categories all UAs with a single one? -----Original Message----- From: James Peach [mailto:jpe...@apache.org] Sent: Monday, February 24, 2014 11:48 PM To: dev Subject: Re: plugin not working On Feb 24, 2014, at 6:42 AM, Raj Sharma <raj.sha...@makemytrip.com> wrote: > Hi, > > I am a software developer in MakeMyTrip.com. I am creating a plugin in Apache Traffic server 3.2.0. Why 3.2.0? 4.1.2 is the latest stable, and closest to the upcoming 4.2.0 release. > For that below are the steps I have been followed- > > * Created a hello-world.c file > #include <stdio.h> > #include <ts/ts.h> > int > check_ts_version() > { > > const char *ts_version = TSTrafficServerVersionGet(); int result = 0; > > if (ts_version) { > int major_ts_version = 0; > int minor_ts_version = 0; > int patch_ts_version = 0; > > if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, > &minor_ts_version, &patch_ts_version) != 3) { > return 0; > } > > /* We need at least Traffic Server 2.0 */ > > if (major_ts_version >= 2) { > result = 1; > } > > } > > return result; > } > > void > TSPluginInit (int argc, const char *argv[]) { > > TSPluginRegistrationInfo info; > > info.plugin_name = "hello-world"; > info.vendor_name = "MyCompany"; > info.support_email = "ts-api-supp...@mycompany.com"; > > if (!TSPluginRegister (TS_SDK_VERSION_2_0 , &info)) { TSPluginRegister returns a TS_ERROR when it fails, which has the value -1. You should register against TS_SDK_VERSION_3_0. > TSError ("Plugin registration failed. \n"); > } > > if (!check_ts_version()) { > TSError ("Plugin requires Traffic Server 2.0 or later\n"); > return; > } > > TSDebug ("debug-hello", "Hello World!\n"); } If you enable diagnostic tags, and set the "debug-hello" tag, then you ought to see this message printed in the diagnostics log. https://trafficserver.readthedocs.org/en/latest/reference/configuration/records.config.en.html#diagnostic-logging-configuration For a quick test, you can do: sudo $PREFIX/bin/traffic_server -T debug-hello > * Compiled it with "tsxs -o hello-world.so -c hello-world.c" > * Installed with "sudo tsxs -o hello-world.so -i" > * Then updated my plugin.config file by just adding one line # a > simple plugin.config for hello-world.so > /usr/local/libexec/trafficserver/hello-world.so /usr/local/etc/trafficserver/hello-world.config > * Then specified the path in records.config file like- CONFIG > proxy.config.plugin.plugin_dir STRING /usr/local/libexec/trafficserver > > After these configuration I restarted my traffic server but I am unable to use this plugin. Basically I need such plugin which can categories the HTTP header user agents and I think it can be resolved by using header_filter plugin. > Can you tell me the complete process for creating new plugins or use existing plugins, also tell me that how can I check whether my plugin is working on not. > > Kindly revert me asap. > > > Thanks and Regards, > Raj Sharma | Software Developer - Technology Development > +918010833979 +918010833979 | MakeMyTrip.com, 243 SP Infocity, Udyog > +Vihar Phase 1, Gurgaon, Haryana - 122 016, India