Collecting Logs

On the log service containers, a script is available to compress logs collected and put at output path mentioned below. Container and access logs can be collected between two dates.

OUTPUT PATH: /mnt/data
Options Possible Values Default
-c | ( --container-type) ALL or any container name (e.g. tml-log,tml-sql,tml-nosql,tml-tm,tml-cache,tml-cm) 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
-t | (--log-type) It can be ALL,METRIC or CONTAINER ALL
-s | (--start-date) It represents the start date of the log collection. Format is yyyy_mm_dd NA
-e | (--end-date) It represents end date till what logs need to be collected. Format is yyyy_mm_dd 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.

Scenario 1: To get all the logs

  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.

Scenario 2: To get only one container type's logs from all hosts

  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.

Scenario 3: To get logs from one container type's one host

  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".
  4. User can also collect logs between two dates by using start-date and end-date option.
    /opt/mashery/containeragent/bin/getlogs.sh --container-type tml-sql --container-hostname mysql-set-0-1 --start-date 2019_08_13 --end-date 2019_08_14
    Note: By default, access logs are not part of the above tar.

Scenario 4: To get metric logs only

  1. Connect to log container.
  2. Run the following command:
    /opt/mashery/containeragent/bin/getlogs.sh --log-type METRIC
  3. Download the tar file from the /mnt/data folder, which will have a name similar to All-logs_2019_08_14_06_56.tar.gz.
  4. User can also collect logs between two dates by using start-date and end-date option.
    /opt/mashery/containeragent/bin/getlogs.sh --log-type METRIC
    Note: By default, access logs are not part of the above tar and only metric logs would be added to tar file.

Scenario 5: To get access logs

  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.
  4. User can also collect logs between two dates by using start-date and end-date option.
    /opt/mashery/containeragent/bin/getlogs.sh --container-type tml-sql --start-date 2019_08_13 --end-date 2019_08_14
    Note: User cannot use the access log option with any of the above scenario for getting access logs. Either access logs or other logs can be collected, not both

Scenario 6: Wrong selection

You cannot select container-type as ALL and specific hostname.

Example 1:
/opt/mashery/containeragent/bin/getlogs.sh --container-hostname mysql-set-0-1
 ERROR: Please provide proper input. --container-hostname|-n can be given with --container-type|-c
Example 2:
/opt/mashery/containeragent/bin/getlogs.sh --container-type ALL --container-hostname mysql-set-0-1
ERROR: Please provide proper input. --container-hostname|-n can be given with --container-type|-c

You cannot collect both access logs and other logs together.

Example:
/opt/mashery/containeragent/bin/getlogs.sh -a --container-type tml-sql

ERROR: Access logs and other logs can not be collected at the same time. Only one type of logs can be collected