Installing and managing Docker connector
To derive insights from logs and troubleshoot issues by analyzing the logs, start with log collection. To collect logs from applications running on docker containers, download and install Docker connector.
The following image shows the list of tasks that you can perform for the connector:
Before you begin
- Make sure that the host computer on which you plan to install the connector has a 2-core CPU and 16 GB RAM.
- Make sure that you are downloading and installing the connector on one of the following operating systems:
- RHEL 8.x, 7.x
- CentOS 8.x, 7.x
- Ubuntu 20.x, 18.x
- Make sure that you have installed docker version 18.01 or later.
To download and install a connector
- From the Collection menu, select Connectors.
- On the Connectors page, click Create.
- To add connector details, perform the following steps:
- In the Connector Name field, enter a unique name for the connector.
- From the Select Connector Type list, select Docker Connector.
- In the Description field, enter description of the connector.
- In the Download Connector step, click Download.
- In the Tags step, add tags (in the form of key-value pairs) to identify the connector, for example, name-windows, location-Pune, and so on.
- In the Download Install Script step, click Download.
The format of the .sh file name is install-connector-<connector name>.sh. For example, if you entered the connector name as my-bmc, the .sh filename is install-connector-my-bmc.sh. - To communicate with the connector through a proxy server, perform the following steps:
- Open the installation script (example: install-connector-my-bmc.sh).
- Locate the following command line: “echo 'FLUENTD_LOG_SIZE_BYTE=10000000' >> $ENV_VARIABLE_FILE_PATH”.
- Before this line, add the following command line:
echo 'HTTP_PROXY=http://<proxy server>' >> $ENV_VARIABLE_FILE_PATH - Save the file.
- Copy the downloaded script and docker image file to the same folder on a docker-enabled server.
- (Optional) To collect logs from files that are located outside the container, in the downloaded script, locate the docker create command statement and create mount points for the log directories.
For example, if logs are generated in the /var/logs directory on the host filesystem, create a mount point by adding the following argument to the docker create command statement: -v /var/logs/:/fluentd/etc/log/. Grant the execute permission to the downloaded script, and then run the script.
For example, run the following commands:
chmod +x install-connector-my-bmc.sh
./install-connector-my-bmc.shTo view the container logs, see the /opt/bmc/connectors/<connector_name>/logs/fluent.log file.
To verify the connector installation
To verify the connector installation, go to the Collection menu and click Connectors, and look for the installed connector on the page. Connectors are available in one of the following status:
- Created: The connector was installed successfully, but has not started sending heartbeats.
- Active: The connector is sending heartbeats.
- Suspended: The connector has not sent heartbeats for a pre-configured time. You can delete a connector only in this status.
To find the container ID for a connector
- On the server where you installed the connector, open the command line interface.
Run the following command:
docker ps
The following image shows a sample container ID:
To reload a connector
- Run the following command:
docker ps Log in to the docker container and reload the connector by running the following command:
docker exec -it <containerID> bash reload.sh
To start and stop a connector
- To start a connector, run the following command:
docker start <containerID> - To stop a connector, run the following command:
docker stop <containerID>
To delete a connector
- Make sure that the connector is not associated with a collection policy.
- Stop the connector and wait for 5 minutes.
When you stop the connector, its status changes to Suspended. - On the Connector page, for the required connector, click the Actions menu and select Delete.
If you deleted the connector from the virtual machine before deleting it from the Connectors page, use the Force Delete option to remove the connector from BMC Helix Log Analytics. - Confirm deletion by clicking Yes.
- Delete the docker container from the computer where you had installed it.
Where to go from here