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 flags
clustermanager set verbose -h
Output 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

Verbose logging is a toggle switch. To re-enable verbose logging:
  1. Turn off verbose logging if it was turned on.
  2. Turn on verbose logging.
1. Turn off verbose logging:
clustermanager set loglevel --componentType trafficmanager --logLevel OFF --loggerName verboselogging
2. Turn on verbose logging:
clustermanager set verbose --enable=true --interval 15
3. 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/verbose
Verbose Log Path:
1. 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.log
Disable 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 command help:
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
Listing loggers on a specific 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 logservice
Verifying 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.

To change the log sync interval:
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.

OUTPUT PATH: /mnt/data
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
For example, filenames for all the logs would be all-logs_2018_11_20_14_32.tar.gz or access-logs_2018_11_20_14_32.tar.gz or tm-log-log-set-0-0-logs_2018_11_20_14_32.tar.gz.
  1. Connect to log container.
  2. Run the following command:
    /opt/mashery/containeragent/bin/getlogs.sh
  3. Download the tar file from the /mnt/data folder, which will have a name similar to "all-logs_2018_11_20_14_32.tar.gz".
    Note: By default, access logs are not part of the above tar.
  1. Connect to log container.
  2. Run the following command:
    /opt/mashery/containeragent/bin/getlogs.sh --container-type tml-sql
  3. Download the tar file from the /mnt/data folder, which will have a name similar to "tml-sql-ALL-logs_2018_11_20_14_32.tar.gz".
    Note: By default, access logs are not part of the above tar.
  1. Connect to log container.
  2. Run the following command:
    /opt/mashery/containeragent/bin/getlogs.sh --container-type tml-sql -container-hostname mysql-set-0-1
  3. Download the tar file from the /mnt/data folder, which will have a name similar to "tml-sql-mysql-set-0-1-logs_2018_11_20_14_32.tar.gz".
    Note: By default, access logs are not part of the above tar.
  1. Connect to log container.
  2. Run the following command:
    /opt/mashery/containeragent/bin/getlogs.sh --access-log
  3. Download the tar file from the /mnt/data folder, which will have a name similar to "access-logs_2018_11_20_14_32.tar.gz".
    Note: You can use the access log option with any of the above scenarios for getting access logs. A separate tar file is generated for access logs
You cannot select container-type as ALL and specific hostname. For example:
/opt/mashery/containeragent/bin/getlogs.sh --container-hostname mysql-set-0-1
Output:
Wrong selection : Hostname cannot be selected when container type is ALL
Another example:
/opt/mashery/containeragent/bin/getlogs.sh --container-type ALL --container-hostname mysql-set-0-1
output :
Wrong selection : Hostname cannot be selected when container type is ALL