Use the Bare Metal Orchestrator CLI to export logs and audit logs to help you monitor and troubleshoot your Bare Metal Orchestrator cluster. Audit logs are currently presented only in log format.
- You must have write permissions to run these commands. Contact your Bare Metal Orchestrator administrator.
- An active OpenSearch account is required.
- Ensure there is enough available space on the target machine where you export the logs.
You can export Bare Metal Orchestrator logs or audit logs to a .tar file in the directory where the command is initiated. Gathered logs are saved in JSON format.
The maximum number of logs collected is 10,000. If your results exceed 10,000 log entries, then multiple JSON files are included in the .tar file. For example: if the pull produces 20,000 hits, then two JSON files with 10,000 log entries each are included in the .tar file.
The current date and time are appended to the download .tar file name. For example, the downloaded .zip file for logs collected on April 19, 2023 at 1:30:12 pm is named as follows:
bmologs_2023_04_19_14_30_12.tar
For audit logs, the .tar file name specifies bmoaudit instead of bmologs.
The following is a sample entry in the extracted logs.json file:
{
"Id": "73cdf444-5045-4ffc-b11d-a1e63efef93e",
"messageid": "iVJQLYYBlcMx5fbRgkx-",
"file_name": "workspace/api/v1alpha1/site_webhook_conversion.go:42 ",
"message": " Calling conversion webhook, ConvertFrom goroutineID=7916",
"log_level": "INFO",
"service_name": "mw-site-controller-controller-manager-679f4f4f4c-wqf4c ",
"site": "gc",
"timestamp": "2023-04-19T14:30:12.183469809-06:00"
}
To export logs and audit logs:
- Establish a CLI session on the Bare Metal Orchestrator VM and log in. For high availability configurations, establish a CLI session using the virtual IP (VIP) of the Load Balancers for the Bare Metal Orchestrator cluster.
- To export logs, do one of the following:
-
Run the following command to pull logs for the past 10 days:
bmo get logs -u <username> -p <password>
where
<username>
is your OpenSearch username and<password>
is your OpenSearch password. -
Run the following command to pull all logs from the specified date entered as yyyy-mm-dd up to the present date and time. For example: enter
2023-05-11
for May 11, 2023.bmo get logs -d <yyyy-mm-dd> -u <username> -p <password>
-
Run the following command to pull logs for a specific date range:
bmo get logs -d "<yyyy-mm-dd> <yyyy-mm-dd>" -u <username> -p <password>
For example, enter the following to pull logs from May 1 to May 11, 2023 (inclusive.)
bmo get logs -d "2023-05-01 2023-05-11" -u myusername -p mypassword
To pull logs for a specific date, enter the same value for the start date and the end date, for example:
bmo get logs -d "2023-05-11 2023-05-11" -u myusername -p mypassword
-
- To export audit logs, do one of the following:
-
Run one of the following commands to pull audit logs for the past 10 days:
bmo get logs -q audit -u <username> -p <password>
bmo get logs -q auditlog -u <username> -p <password>
where
<username>
is your OpenSearch username and<password>
is your OpenSearch password. -
Run the following command to pull audit logs from the specified date entered as yyyy-mm-dd up to the present date and time. For example: enter
2023-05-11
for May 11, 2023.bmo get logs -d <yyyy-mm-dd> -q audit -u <username> -p <password>
-
Run the following command to pull audit logs for a specific date range:
bmo get logs -d "<yyyy-mm-dd> <yyyy-mm-dd>" -q audit -u <username> -p <password>
For example, enter the following to pull audit logs from May 1 to May 11, 2023 (inclusive.)
bmo get logs -d "2023-05-01 2023-05-11" -q audit -u myusername -p mypassword
To pull audit logs for a specific date, enter the same value for the start date and the end date. For example:
bmo get logs -d "2023-05-11 2023-05-11" -q audit -u myusername -p mypassword
-