To conserve resources and simplify configuration, a single Scalyr Agent can be used to manage logs for Docker containers and the host where it is installed. In this configuration, the Scalyr Agent is not containerized, as it runs on the host and monitors logs logs generated by the host and any Docker containers.
These instructions apply to Python 2.6, 2.7, and Python 3.5+
This article assumes that the Scalyr Agent has already been installed and is working properly.
Next, get the recommended versions of the Python docker and requests libraries by visiting the Scalyr Agent GitHub repository and accessing the dev-requirements.txt file. The versions provided in this file have been tested with the Scalyr Agent.
Confirm which versions of the Python docker and requests libraries are presently installed:
If needed, uninstall any incompatible or older versions, then install the recommended versions as follows:
pip install docker==<RECOMMENDED_VERSION_NUMBER>
pip install requests==<RECOMMENDED_VERSION_NUMBER>
Update Scalyr Agent Monitors Config
Add the following to the monitors section of your Scalyr Agent config:
More details on the Docker monitor's parameters can be found here: https://app.scalyr.com/help/monitors/docker-monitor
Once the above changes have been made, restart the Scalyr Agent
Update Scalyr Agent Logs Config
Run scalyr-agent-2 status -v and confirm that no errors are being generated by the Docker monitor that you just configured. If everything looks good, you can proceed with setting up the logs section of the Scalyr Agent configuration file.