Newrelic LogSpout
A Docker image to stream logs from your containers to Newrelic. Based on LogDNA Logspout.
NOTE: This is not production ready.
How to Use
Environment Variables
The following variables can be used to tune LogSpout
for specific use cases.
Log Router Specific
- FILTER_NAME: Filter by Container Name with Wildcards, Optional
- FILTER_ID: Filter by Container ID with Wildcards, Optional
- FILTER_SOURCES: Filter by Comma-Separated List of Sources, Optional
- FILTER_LABELS: Filter by Comma-Separated List of Labels, Optional
Note: More information can be found here.
Ingestion Specific
- NEWRELIC_KEY: Newrelic License Key, Required
- HOSTNAME: Alternative Hostname, Optional
- Default: System's Hostname
- NEWRELIC_URL: Specific Endpoint to Stream Log into, Optional
- Default:
log-api.newrelic.com/log/v1
Note: Logging the LogSpout
Container is recommended to keep track of HTTP Request Errors or Exceptions.
Limits
- FLUSH_INTERVAL: How frequently batches of logs are sent (in
milliseconds
), Optional
- HTTP_CLIENT_TIMEOUT: Time limit (in
seconds
) for requests made by this HTTP Client, Optional
- INACTIVITY_TIMEOUT: How long to wait for inactivity before declaring failure in the
Docker API
and restarting, Optional
- Default: 1m
- Note: More information about the possible values can be found here. Also see
time.ParseDuration
for valid format as recommended here.
- MAX_BUFFER_SIZE: The maximum size (in
mb
) of batches to ship to Newrelic
, Optional
- MAX_REQUEST_RETRY: The maximum number of retries for sending a line when there are network failures, Optional
Docker
Create and run container named logspout from this image using CLI:
sudo docker run --name="logspout-newrelic" --restart=always \
-d -v=/var/run/docker.sock:/var/run/docker.sock \
-e NEWRELIC_KEY="<Newrelic License Key>" \
mgreenw/logspout-newrelic:latest
Docker Cloud
Append the following to your Docker Cloud stackfile:
logspout-newrelic:
autoredeploy: true
deployment_strategy: every_node
environment:
- NEWRELIC_KEY="<Newrelic License Key Key>"
image: mgreenw/logspout-newrelic:latest
restart: always
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'