Introduction
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.
Configuration
Python Version
These instructions apply to Python 2.6, 2.7, and Python 3.5+
Install Libraries
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:
pip freeze
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:
monitors: [
...
{
module: "scalyr_agent.builtin_monitors.docker_monitor",
api_socket: "/var/run/docker.sock",
labels_as_attributes: true,
label_include_globs: ["*"],
label_exclude_globs: ["com.scalyr.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.
Comments
0 comments
Please sign in to leave a comment.