Interacting with Loggers
This section details using Cluster Manager CLI to interact with the different loggers in the system. The administrator can use Cluster Manager to adjust logging levels to collect more or fewer details. This section also assumes that proper clusters and zones have been set.
Most of the commands require a specific component Id. To identify the component id, refer to the following
Example component id listing:
Enabling Debug/Verbose Logging
Verbose logging is used to debug API processing by Traffic Manager.
verbose logging options and flagsclustermanager set verbose -hOutput of help
Set verbose log for traffic manager(s) in the scope of a cluster/zone/component Usage: clustermanager set verboselog [flags] Aliases: verboselog, verbose Flags: --clusterId string cluster ID of the component --componentId string ID of the component --enable Enable or disable verbose logging. 'enable=true' if the flag is empty (default true) -h, --help help for verboselog --interval int Time interval to enable verbose logging. Value must be between 1-30 (minutes) (default -1) --zoneId string zone ID of the component
Steps to use verbose logging features
clustermanager set loglevel --componentType trafficmanager --logLevel OFF --loggerName verboselogging2. Turn on verbose logging:
clustermanager set verbose --enable=true --interval 153. Verifying if verbose logging is turned off or on:
clustermanager ls loggers --componentType trafficmanager --componentId <componentid>Output of verbose logging verification command
clusterId [1cac153d-48db-4d5c-b3fc-9d25673ee536] and zoneId [a127e639-737c-4220-b42f-da9f14e939dc] Using cluster name [Tibco Mashery Local Reference Cluster] Using Zone name [local] Using Component ID [1bdbc338-946d-42df-a535-5f72b0144372] of type [trafficmanager] LoggerName LogLevel Process ------------------------------------------------------------ ---------- -------------------- com.mashery.tml.container.agent INFO com.mashery.tml.log INFO com.mashery.tml.log.access.consumer INFO com.mashery.proxy INFO com.mashery.cassandra.client INFO com.mashery.oauth2 INFO com.mashery.trafficmanager.sdk INFO com.mashery.internal.http INFO verboselogging INFO
In the above output, notice that "verboselogging" is set to INFO, that is, ON.
if you disable the verbose logging, the "verboselogging" value will be set to OFF.
Verbose-log-path: /mnt/data/trafficmanager/verbose1. Connect to tml-log container 2. Go to /mnt/data/trafficmanager/verbose path 3. Folders with the POD_IP of tm containers would be created and it would have folder with request_time_epoch_requestId e.g /mnt/data/trafficmanager/verbose/10.244.1.7/1542644771940-eb336334-9c83-4590-b451-d9b340539ca4 4. The above path would have required four files i.e. inboundProcessed.log inboundRequest.log outboundProcessed.log outboundResponse.logDisable Verbose Logging:
clustermanager set verbose --enable=false --interval 0
Changing log levels in containers
The administrator can change log levels of different loggers using Cluster Manager.
set loglevel -h Set log level in the scope of a cluster/zone/component Usage: clustermanager set loglevel [flags] Flags: --clusterId string cluster ID of the component --componentId string ID of the component --componentType string type of the component, valid types [sql, nosql, cache, trafficmanager, logservice] -h, --help help for loglevel --logLevel string New log level, valid types [DEBUG, TRACE, INFO, WARN, ERROR] --loggerName string Name of the logger to change log level --zoneId string zone ID of the component
clustermanager ls loggers --componentType trafficmanager --componentId <component id>Output of listing loggers command:
clusterId [1cac153d-48db-4d5c-b3fc-9d25673ee536] and zoneId [a127e639-737c-4220-b42f-da9f14e939dc] Using cluster name [Tibco Mashery Local Reference Cluster] Using Zone name [local] Using Component ID [1bdbc338-946d-42df-a535-5f72b0144372] of type [trafficmanager] LoggerName LogLevel Process ------------------------------------------------------------ ---------- -------------------- com.mashery.tml.container.agent INFO com.mashery.tml.log INFO com.mashery.tml.log.access.consumer INFO com.mashery.proxy INFO com.mashery.cassandra.client INFO com.mashery.oauth2 INFO com.mashery.trafficmanager.sdk INFO com.mashery.internal.http INFO verboselogging INFO
Note the logger name from above list from running the list loggers command.
Changing the log level of a logger:#This sets log level to INFO for com.mashery.tml.container.agent on all components of type logservice. Optionally pass componentId flag to change log level on specific component cm set loglevel --loggerName com.mashery.tml.container.agent --logLevel INFO --componentType logserviceVerifying log level change:
clustermanager ls loggers --componentType logservice --componentId bb32be63-2a72-455e-9ffd-3e65174d119a
The log sync interval is used by the sync process which sends logs to Mashery reporting service on TIBCO Cloud™ Mashery. It is the periodic interval and end of which the sync process sends logs. The default value is 15 minutes.
cm set logsyncinterval --syncInterval 5 --componentType logservice --componentId bb32be63-2a72-455e-9ffd-3e65174d119a
Collecting Logs
On the log service containers, a script is available to zip logs collected and put at output path mentioned below.
Options | Possible Values | Default |
---|---|---|
-c | ( --container-type) | ALL or any container name (e.g. tm-log,tm-sql,tm-nosql,tm-tm,tm-cache) | ALL |
-n | (--container-hostname) | ALL or any hostname for the selected container-type. It won't allow to have only hostname passed without selecting container-type. | ALL |
-a | (--access-log) | No need to pass any value. If this param is selected then access logs would also be collected in separate file. | NA |
-h | (--help) | NA. Would print usage details for this utility | NA |
/opt/mashery/containeragent/bin/getlogs.sh --container-hostname mysql-set-0-1Output:
Wrong selection : Hostname cannot be selected when container type is ALLAnother example:
/opt/mashery/containeragent/bin/getlogs.sh --container-type ALL --container-hostname mysql-set-0-1output :
Wrong selection : Hostname cannot be selected when container type is ALL