GELF
Coralogix provides a simple and seamless Gelf integration driver for your Docker logs. Ship your logs directly from your containers without having to install any SDK or agent, and get started in minutes.
Usage
This document includes cluster dependent URL's. Each URL has a variable part (in Italic). Please match this part with a row entry within the following table. Copy the table row entry located under the column that matches the top level domain of your Coralogix account (.com, .in etc.). Replace the variable part of the URL with this entry.
[table id=80 /]
Provide the following four variables:
PRIVATE_KEY - Your Send-Your-Data API key is a unique ID that represents your company.
COMPANY_ID - A unique number which represents your company. You can get your company id from the settings tab in the Coralogix dashboard.
APP_NAME - The name of your environment, for example, a company named “SuperData” would probably insert the “SuperData” string parameter or if they want to debug their test environment they might insert the “SuperData–Test”.
SUB_NAME - Your application probably has multiple components, for example, Backend servers, Middleware, Frontend servers etc. in order to help you examine the data you need, inserting the subsystem parameter is vital.
Example
If you run your containers manually:
docker run -dit \
-e PRIVATE_KEY="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" \
-e COMPANY_ID=XXXX \
-e APP_NAME="simple-application" \
-e SUB_NAME="backend" \
--log-driver=gelf \
--log-opt gelf-address=udp://syslogserver.Cluster URL:20001 \
--log-opt env=PRIVATE_KEY,APP_NAME,SUB_NAME,COMPANY_ID \
alpine echo "Hello world!"
You can also use it with docker-compose.yml:
version: "3"
services:
web:
restart: always
build: app
container_name: flask-app
# Setup required parameters for Coralogix integration
environment:
- PRIVATE_KEY=${PRIVATE_KEY}
- APP_NAME=${APP_NAME:-flask-app}
- SUB_NAME=${SUB_NAME:-backend}
- COMPANY_ID=${COMPANY_ID}
# Setup logging driver
logging:
driver: gelf
options:
# Address of Coralogix syslog server
gelf-address: "udp://syslogserver.coralogix.com:20001"
# Required parameters for request
env: "PRIVATE_KEY,APP_NAME,SUB_NAME,COMPANY_ID"
ports:
- "5000:5000"
Before using this integration, make sure you create a .env file with configurations or write them directly to the docker-compose.yml file.
Now you should have your docker logs streaming to Coalogix. Not seeing your logs in our LiveTail? Use our in-app chat for support.
You can try to deploy our example application: Source code.