5.2.5 The collect logs Command

collect logs [cluster_name]

This command collects log files and other related files from all hosts. When the name of a cluster (cluster_name) is supplied with the command, it collects all the log files (.log) as well as the configuration files (.ini, .cnf), error files (.err), and trace files (.trace.log.*) used by all processes belonging to the cluster, and also all the agent log files. If cluster_name is omitted, only the agent log files are collected.

When an mcmd agent receives the collect logs command from the mcm agent it is connected with, it sets up a TCP server socket using port 0 by default, and lets the operating system assign the actual port number. All agents in the site are then instructed to perform the copying, and each of them spawns a TCP client, which connects to the TCP server socket set up earlier to copy the files over.

To assign a specific port manually for file copying, use the --copy-port option when starting mcmd. Default value for the option is 0. The collect logs command times out if, in 30 seconds, no connections can be established by any of the clients or no incoming connections are detected by the TCP server.

Warning

If a firewall or other networking issues prohibit the TCP clients to connect to the TCP server socket, the collect logs command will never complete.

The collected files are put under the MySQL Cluster Manager data repository (mcm_data in the parent directory of the MySQL Cluster Manager installation directory) by default, or specified by the option --data-folder) inside a folder named collected_files, under which the files are organized under a hierarchy that looks like the following:

/mcm_data_repository/collected-files/
|── timestamp/
|  ├── mcmd/
|  |   ├── mcmd#/
|  |       ├── mcmd.log
|  |       └── mcmd_timestamp.log
|  |       └── ...
|  ├── cluster_name/
|      ├── node#_nodetype/
|      |   ├── log files (.log) 
|      |   ├── configuration files (.ini, .cnf)
|      |   ├── error files (.err)
|      |   └── trace files (.trace.log.*)
|      ├── node#_nodetype/
|      |   ├── log files (.log) 
|      |   ├── configuration files (.ini, .cnf)
|      |   ├── error files (.err)
|      |   └── trace files (.trace.log.*)
|      ├── node#_nodetype/
|      |   └── ...
|      └── other/
|          ├── utilities files (.err, .out)
|          └── ...
|                    
├── timestamp/
|  ├── mcmd/
|  |   ├── mcmd#/
|  |       ├── mcmd.log
|  |       ├── mcmd_timestamp.log
|  |       └── ...
|  ├── cluster_name/
|  |   ├── node#_nodetype/
...

For example, the error log for the mysqld node of node number 146 is found at:

 /opt/mcm_data/collected-files/2021-07-31T07:44:05Z/51_mysqld/mysqld_146_out.err