You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -156,6 +156,44 @@ Logspout relies on the Docker API to retrieve container logs. A failure in the A
156
156
*`SYSLOG_TAG` - datum for tag field (default `{{.ContainerName}}+route.Options["append_tag"]`)
157
157
*`SYSLOG_TIMESTAMP` - datum for timestamp field (default `{{.Timestamp}}`)
158
158
159
+
#### Using Logspout in a swarm
160
+
161
+
In a swarm, logspout is best deployed as a global service. When running logspout with 'docker run', you can change the value of the hostname field using the `SYSLOG_HOSTNAME` environment variable as explained above. However, this does not work in a compose file because the value for `SYSLOG_HOSTNAME` will be the same for all logspout "tasks", regardless of the docker host on which they run. To support this mode of deployment, the syslog adapter will look for the file `/etc/host_hostname` and, if the file exists and it is not empty, will configure the hostname field with the content of this file. You can then use a volume mount to map a file on the docker hosts with the file `/etc/host_hostname` in the container. The sample compose file below illustrates how this can be done
162
+
163
+
```
164
+
version: "3"
165
+
networks:
166
+
logging:
167
+
services:
168
+
logspout:
169
+
image: gliderlabs/logspout:latest
170
+
networks:
171
+
- logging
172
+
volumes:
173
+
- /etc/hostname:/etc/host_hostname:ro
174
+
- /var/run/docker.sock:/var/run/docker.sock
175
+
command:
176
+
syslog://svt2-logger.am2.cloudra.local:514
177
+
deploy:
178
+
mode: global
179
+
resources:
180
+
limits:
181
+
cpus: '0.20'
182
+
memory: 256M
183
+
reservations:
184
+
cpus: '0.10'
185
+
memory: 128M
186
+
```
187
+
188
+
logspout can then be deployed as a global service in the swam with the following command
189
+
190
+
```bash
191
+
docker stack deploy --compose-file <name of your compose file>
192
+
```
193
+
194
+
More information about services and their mode of deployment can be found here:
The standard distribution of logspout comes with all modules defined in this repository. You can remove or add new modules with custom builds of logspout. In the `custom` dir, edit the `modules.go` file and do a `docker build`.
0 commit comments