Skip to content

Commit

Permalink
Merge pull request #170 from sematext/megastef-logagent-updates
Browse files Browse the repository at this point in the history
Update for LA log routing options for containers
  • Loading branch information
Adnan Rahić committed Feb 15, 2020
2 parents 4913dd3 + 4baa589 commit 12ec693
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions docs/logagent/installation-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,44 +484,49 @@ The component for detecting and parsing log messages — [logagent-js](http://se

### Log Routing

Routing logs from different containers to separate Sematext Cloud Logs Apps can be configured via docker labels (or environment variables e.g. on Kubernetes). Simply tag a container with the label (or environment variable) ```LOGS_TOKEN=YOUR_LOGS_TOKEN```.
Routing logs from different containers to separate Sematext Cloud Logs Apps can be configured via Docker labels, or environment variables, e.g. on Kubernetes.

Tag a container with the label, or environment variable ```LOGS_TOKEN=YOUR_LOGS_TOKEN```.
Logagent inspects the containers for this label and ships the logs to the specified Logs App.

The following container environment variables and labels are supported:

- `LOGS_TOKEN=<YOUR_LOGS_TOKEN>` - logs token for the container
- `LOGS_ENABLED=<true|false>` - switch log collection for the container on or off. Note, the default value is configurable in Logagent configuration via the setting LOGSENE_ENABLED_DEFAULT.
- `LOGS_RECEIVER_URL=<URL, URL, URL>` - set multiple log destinations. The URL should include the token or index of an Elasticsearch API endpoint. E.g. `https://logsene-receiver.sematext.com/your_logs_token`
- `LOGS_ENABLED=<true|false>` - switch log collection for the container on or off. Note, the default value is configurable in Logagent configuration via the setting `LOGSENE_ENABLED_DEFAULT`.
- `LOGS_RECEIVER_URL=<URL, URL, URL>` - set multiple log destinations. The URL should include the token or index of an Elasticsearch API endpoint. E.g. `https://logsene-receiver.sematext.com/<YOUR_LOGS_TOKEN>`

The Kubernetes pod annotations `sematext.com/logs-token=<YOUR_LOGS_TOKEN>`, `sematext.com/logs-enabled=<true|false>`, and`sematext.com/logs-receiver-urls=<url,url,url>` are equivalent.


__Example:__
The following command will start Nginx webserver and logs for this container will be shipped to the related Logs App.
Routing logs from different containers to separate Sematext Cloud Logs Apps can be configured via docker labels (or environment variables e.g. on Kubernetes). Simply tag a container with the label (or environment variable) ```LOGSENE_TOKEN=YOUR_LOGSENE_TOKEN```.
Logagent inspects the containers for this label and ships the logs to the specified Logs App.

```
docker run --label LOGS_TOKEN=REPLACE_WITH_YOUR_LOGS_TOKEN -p 80:80 nginx
# or use environment variable on Kubernetes (no support for Docker labels)
# docker run -e LOGS_TOKEN=REPLACE_WITH_YOUR_LOG_TOKEN -p 80:80 nginx
```

Or use environment variables for Kubernetes:

```
docker run -e LOGS_TOKEN=REPLACE_WITH_YOUR_LOG_TOKEN -p 80:80 nginx
```

All other container logs will be shipped to the Logs App specified in the docker run command for ```sematext/logagent``` with the environment variable ```LOGS_TOKEN```.

By default, all logs from all containers are collected and sent to Sematext Cloud/Elasticsearch. You can change this default by setting the ```LOGS_ENABLED_DEFAULT=false``` label for the Logagent container. This default can be overridden, on each container, through the ```LOGS_ENABLED``` label.
By default, all logs from all containers are collected and sent to Sematext Cloud. You can change this default by setting the ```LOGS_ENABLED_DEFAULT=false``` label for the Logagent container. This default can be overridden, on each container, through the ```LOGS_ENABLED``` label.

Please refer to [Docker Log Management & Enrichment](https://sematext.com/blog/2017/05/15/docker-log-management-enrichment/) for further details.


## Known Issues

**Conflict with Docker logging-drivers. Logagent is running
with a valid Logs Token, but Sematext Cloud does not show container logs. **

Please note that Logagent collects logs via Docker Remote
API. If you use a Docker logging-driver other than the default json-file
driver, logs will not be available via the Docker Remote API. Please
make sure that your container or docker daemon uses json-file logging
driver, logs will not be available via the Docker Remote API.

Please make sure that your container or docker daemon uses json-file logging
driver. This ensures that logs are exposed via Docker Remote API. To
check, run the "docker logs" command. If "docker logs CID" shows
container logs then Logagent should be able to collect the
Expand Down

0 comments on commit 12ec693

Please sign in to comment.