Skip to content

aminoz007/logspout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logspout Image For New Relic

Build Status Go Report Card GoDoc Release

This is a Logspout custom image that forwards all your containers logs to New Relic via HTTP POST using New Relic Logs API.

This project is provided AS-IS WITHOUT WARRANTY OR SUPPORT, although you can report issues and contribute to the project here on GitHub.

Usage

Docker

docker run --name="newrelic" --restart=always \
-d -v=/var/run/docker.sock:/var/run/docker.sock \
-e "<KEY>=<KEY_VALUE>" aminoz86/logspout-newrelic:latest

Where <KEY> is exactly one of the following:

Property Description
API_KEY Your New Relic API Insert Key
LICENSE_KEY Your New Relic License Key

Careful: the <KEY> name is case sensitive (should be in uppercase as shown above)!!

Elastic Container Service (ECS)

Update your ECS Cloud Services Configuration as detailed below:

services:
  newrelic:
    environment:
        - <KEY>="<KEY_VALUE>"
    image: aminoz86/logspout-newrelic:latest
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      mode: global

Docker Swarm

Update your Docker Swarm Compose file as detailed below:

version: "3"
networks:
  logging:
services:
  newrelic:
    image: aminoz86/logspout-newrelic:latest
    networks:
      - logging
    volumes:
      - /etc/hostname:/etc/host_hostname:ro
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - <KEY>="<KEY_VALUE>"
    deploy:
      mode: global

Configuration

Image configuration: Environment Variables

Property Description Default Value Required or Optional
API_KEY Your New Relic API Insert key Required if LICENSE_KEY is not provided
LICENSE_KEY Your New Relic License key Required if API_KEY is not provided
NEW_RELIC_URL New Relic ingestion endpoint https://log-api.newrelic.com/log/v1 Optional
PROXY_URL Use proxy endpoint to send the data to NR Optional
FILTER_NAME Filter by container name with wildcards. For more information, review logspout docs here! Optional
FILTER_ID Filter by container ID with wildcards. For more information, review logspout docs here! Optional
FILTER_SOURCES Filter by comma-separated list of sources. For more information, review logspout docs here! Optional
FILTER_LABELS Filter by comma-separated list of labels. For more information, review logspout docs here! Optional
HOSTNAME Use this variable to overwrite default Hostname {{Container.Config.Hostname}} Optional
GLOBAL_TAGS Tags all your logs sent to New Relic (example: -e GLOBAL_TAGS="env:prod;team:myTeam") Optional
VERBOSE Capture or not logspout container's logs Enabled (set to 0 to disable) Optional
FLUSH_INTERVAL Harvest cycle (in milliseconds) 250 Optional
MAX_BUFFER_SIZE The maximum size of logs for each POST request (in mb) 1 Optional
MAX_LINE_LENGTH The maximum length for each log message (it gets truncated if it is bigger than this limit) 15000 Optional
MAX_REQUEST_RETRY The maximum number of retries for sending a batch of logs when there are network failures 5 Optional
INACTIVITY_TIMEOUT Logspout relies on the Docker API to retrieve container logs. A failure in the API may cause a log stream to hang. Logspout can detect and restart inactive Docker log streams. Use the environment variable INACTIVITY_TIMEOUT to enable this feature. E.g.: INACTIVITY_TIMEOUT=1m for a 1-minute threshold. 1m Optional

EU image configuration

If you are running this image in the EU set the NEW_RELIC_URL to https://log-api.eu.newrelic.com/log/v1.

Getting Your Keys

  • Getting your New Relic Insights Insert key: https://insights.newrelic.com/accounts/<ACCOUNT_ID>/manage/api_keys

  • Getting your New Relic license key: https://rpm.newrelic.com/accounts/<ACCOUNT_ID>

Issues / Enhancement Requests

Issues and enhancement requests can be submitted in the issues tab of this repository. Please search for and review the existing open issues before submitting a new issue.

Contributing

Contributions are welcome (and if you submit a Enhancement Request, expect to be invited to contribute it yourself 😁).