trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iga...@apache.org
Subject svn commit: r1069990 - in /trafficserver/site/branches/ats-cms/content/docs/trunk: ./ sdk/plugin-management/
Date Fri, 11 Feb 2011 23:48:18 GMT
Author: igalic
Date: Fri Feb 11 23:48:18 2011
New Revision: 1069990

URL: http://svn.apache.org/viewvc?rev=1069990&view=rev
Log:
T-2 Chapters.

Removed:
    trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/accessing-installed-plugin-files.en.mdtext
Modified:
    trafficserver/site/branches/ats-cms/content/docs/trunk/STATUS
    trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/guide-to-the-logging-api.en.mdtext
    trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/index.en.mdtext
    trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/reading-trafficserver-settings-and-statistics.en.mdtext

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/STATUS
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/STATUS?rev=1069990&r1=1069989&r2=1069990&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/STATUS (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/STATUS Fri Feb 11 23:48:18 2011
@@ -65,7 +65,7 @@ continuations -- igalic
 plugin-configurations -- igalic
 actions-guide -- igalic
 io-guide  -- igalic
-plugin-management
+plugin-management -- igalic
 adding-statistics
 sample-source-code --igalic
 troubleshooting-tips

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/guide-to-the-logging-api.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/guide-to-the-logging-api.en.mdtext?rev=1069990&r1=1069989&r2=1069990&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/guide-to-the-logging-api.en.mdtext
(original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/guide-to-the-logging-api.en.mdtext
Fri Feb 11 23:48:18 2011
@@ -0,0 +1,100 @@
+Title: Apache Traffic Server™ Software Developers Kit
+Notice:    Licensed to the Apache Software Foundation (ASF) under one
+           or more contributor license agreements.  See the NOTICE file
+           distributed with this work for additional information
+           regarding copyright ownership.  The ASF licenses this file
+           to you under the Apache License, Version 2.0 (the
+           "License"); you may not use this file except in compliance
+           with the License.  You may obtain a copy of the License at
+           .
+             http://www.apache.org/licenses/LICENSE-2.0
+           .
+           Unless required by applicable law or agreed to in writing,
+           software distributed under the License is distributed on an
+           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+           KIND, either express or implied.  See the License for the
+           specific language governing permissions and limitations
+           under the License.
+
+[Prev](reading-trafficserver-settings-and-statistics) - Reading Traffic Server Settings and
Statistics
+
+Adding Statistics - [Next](../adding-statistics)
+
+## Guide to the Logging API ## {#GuideLoggingAPI}
+
+The logging API enables your plugin to log entries in a custom text log file 
+that you create with the call `TSTextLogObjectCreate`. This log file is part 
+of Traffic Server's logging system; by default, it is stored in the logging 
+directory. Once you have created the log object, you can set log properties. 
+
+The logging API enables you to:
+
+* Establish a custom text log for your plugin:
+see [TSTextLogObjectCreate](link/to/doxygen)
+
+* Set the log header for your custom text log:
+see [TSTextLogObjectHeaderSet](link/to/doxygen)
+
+* Enable or disable rolling your custom text log:
+see [TSTextLogObjectRollingEnabledSet](link/to/doxygen)
+
+* Set the rolling interval (in seconds) for your custom text log:
+see [TSTextLogObjectRollingIntervalSecSet](link/to/doxygen)
+
+* Set the rolling offset for your custom text log:
+see [TSTextLogObjectRollingOffsetHrSet](link/to/doxygen)
+
+* Write text entries to the custom text log:
+see [TSTextLogObjectWrite](link/to/doxygen)
+
+* Flush the contents of the custom text log's write buffer to disk:
+see [TSTextLogObjectFlush](link/to/doxygen)
+
+* Destroy custom text logs when you are done with them:
+see [TSTextLogObjectDestroy](link/to/doxygen)
+
+The steps below show how the logging API is used in the `blacklist-1.c` sample 
+plugin. For the complete source code, see the [_Sample Source Code_](App_SampleSourceCode.html)

+appendix.
+
+1. A new log file is defined as a global variable.
+
+          ::::c
+          static TSTextLogObject log;
+
+2. In `TSPluginInit`, a new log object is allocated:
+
+            ::::c
+            log = TSTextLogObjectCreate("blacklist", TS_LOG_MODE_ADD_TIMESTAMP, NULL, &error);
+The new log is named `blacklist.log`. Each entry written to the log will have 
+a timestamp. The `NULL` argument specifies that the new log does not have a 
+log header. The error argument stores the result of the log creation; if the 
+log is created successfully, then an error will be equal to `TS_LOG_ERROR_NO_ERROR`. 
+
+3. After creating the log, the plugin makes sure that the log was created successfully: 
+
+        ::::c
+        if (!log) {
+            printf("Blacklist plugin: error %d while creating log\n", error);
+        }
+
+4. The `blacklist-1` plugin matches the host portion of the URL (in each client 
+request) with a list of blacklisted sites (stored in the array `sites[ `]): 
+
+       ::::c
+       for (i = 0; i < nsites; i++) {
+           if (strncmp (host, sites[i], host_length) == 0) {
+If the host matches one of the blacklisted sites (such as `sites[i]`), then 
+the plugin writes a blacklist entry to `blacklist.log`:
+
+       ::::c
+       if (log) {
+           TSTextLogObjectWrite(log, "blacklisting site: %s", sites[i]);
+The format of the log entry is as follows:
+
+       :::text
+       <timestamp> blacklisting site: sites[i]
+The log is not flushed or destroyed in the `blacklist-1` plugin - it lives 
+for the life of the plugin.
+
+

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/index.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/index.en.mdtext?rev=1069990&r1=1069989&r2=1069990&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/index.en.mdtext
(original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/index.en.mdtext
Fri Feb 11 23:48:18 2011
@@ -0,0 +1,41 @@
+Title: Apache Traffic Server™ Software Developers Kit
+Notice:    Licensed to the Apache Software Foundation (ASF) under one
+           or more contributor license agreements.  See the NOTICE file
+           distributed with this work for additional information
+           regarding copyright ownership.  The ASF licenses this file
+           to you under the Apache License, Version 2.0 (the
+           "License"); you may not use this file except in compliance
+           with the License.  You may obtain a copy of the License at
+           .
+             http://www.apache.org/licenses/LICENSE-2.0
+           .
+           Unless required by applicable law or agreed to in writing,
+           software distributed under the License is distributed on an
+           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+           KIND, either express or implied.  See the License for the
+           specific language governing permissions and limitations
+           under the License.
+
+
+[Prev](../io-guide/guide-to-cache-api/example) - Example
+
+Reading Traffic Server Settings and Statistics - [Next](reading-trafficserver-settings-and-statistics)
+
+##  Plugin Management ## {#PluginManagement}
+
+This chapter covers the following topics:
+
+* [Reading Traffic Server Settings and Statistics](reading-trafficserver-settings-and-statistics)
+Using the functions in this chapter, plugins read Traffic Server configuration 
+settings and statistics from the `records.config` file.
+
+* [Accessing Installed Plugin Files](accessing-installed-plugin-files)
+Put plugin access-related files in the plugin installation directory and make 
+sure your plugins are preserved during Traffic Server upgrades.
+
+* [Guide to the Logging API](guide-to-the-logging-api)
+The logging API enables your plugin to log text entries in a custom Traffic 
+Server log file. This section provides a basic overview of the logging interface. 
+
+
+

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/reading-trafficserver-settings-and-statistics.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/reading-trafficserver-settings-and-statistics.en.mdtext?rev=1069990&r1=1069989&r2=1069990&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/reading-trafficserver-settings-and-statistics.en.mdtext
(original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/plugin-management/reading-trafficserver-settings-and-statistics.en.mdtext
Fri Feb 11 23:48:18 2011
@@ -0,0 +1,60 @@
+Title: Apache Traffic Server™ Software Developers Kit
+Notice:    Licensed to the Apache Software Foundation (ASF) under one
+           or more contributor license agreements.  See the NOTICE file
+           distributed with this work for additional information
+           regarding copyright ownership.  The ASF licenses this file
+           to you under the Apache License, Version 2.0 (the
+           "License"); you may not use this file except in compliance
+           with the License.  You may obtain a copy of the License at
+           .
+             http://www.apache.org/licenses/LICENSE-2.0
+           .
+           Unless required by applicable law or agreed to in writing,
+           software distributed under the License is distributed on an
+           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+           KIND, either express or implied.  See the License for the
+           specific language governing permissions and limitations
+           under the License.
+
+
+[Prev](PluginManagement.html) - Plugin Management
+
+Guide to the Logging API - [Next](guide-to-the-logging-api)
+
+## Reading Traffic Server Settings and Statistics ## {#ReadingTSSettingsStatistics}
+
+Your plugin might need to know information about Traffic Server's current configuration 
+and performance. The functions described in this section read this information 
+from the Traffic Server `records.config` file. Configuration settings are stored 
+in `CONFIG` variables and statistics are stored in `PROCESS` variables.
+
+![[Caution]](/images/docbook/caution.png)
+
+**Caution** 
+
+Not all `CONFIG` and `PROCESS` variables in `records.config` are relevant to 
+Traffic Server's configuration and statistics. Therefore, retrieve only the 
+`records.config` variables that are documented in the [Traffic Server Administrator's 
+Guide](../admin/).
+
+To retrieve a variable, you need to know its type (`int`, `counter`, `float`, 
+or `string`). Plugins store the `records.config` values as an `TSMgmtInt`, 
+`TSMgmtCounter`, `TSMgmtFloat`, or `TSMgmtString`. You can look up `records.config` 
+variable types in the [Traffic Server Administrator's Guide](../../admin/).
+
+Depending on the result type, you'll use `TSMgmtIntGet`, `TSMgmtCounterGet`, 
+`TSMgmtFloatGet`, or `TSMgmtStringGet` to obtain the variable value (see 
+the example for [TSMgmtIntGet](link/to/doxygen).
+
+The `TSMgmt*Get` functions are:
+
+* [TSMgmtCounterGet](link/to/doxygen)
+
+* [TSMgmtFloatGet](link/to/doxygen)
+
+* [TSMgmtIntGet](link/to/doxygen)
+
+* [TSMgmtStringGet](link/to/doxygen)
+
+
+



Mime
View raw message