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,85 @@ 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
+
#### Raw Format
160
+
161
+
The raw adapter has a function `toJSON` that can be used to format the message/fields to generate JSON-like output in a simple way, or full JSON output.
"message": "2017-10-26 11:59:32,950 INFO success: command_bus_0 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)"
196
+
}
197
+
198
+
```
199
+
200
+
#### Using Logspout in a swarm
201
+
202
+
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
203
+
204
+
```
205
+
version: "3"
206
+
networks:
207
+
logging:
208
+
services:
209
+
logspout:
210
+
image: gliderlabs/logspout:latest
211
+
networks:
212
+
- logging
213
+
volumes:
214
+
- /etc/hostname:/etc/host_hostname:ro
215
+
- /var/run/docker.sock:/var/run/docker.sock
216
+
command:
217
+
syslog://svt2-logger.am2.cloudra.local:514
218
+
deploy:
219
+
mode: global
220
+
resources:
221
+
limits:
222
+
cpus: '0.20'
223
+
memory: 256M
224
+
reservations:
225
+
cpus: '0.10'
226
+
memory: 128M
227
+
```
228
+
229
+
logspout can then be deployed as a global service in the swam with the following command
230
+
231
+
```bash
232
+
docker stack deploy --compose-file <name of your compose file>
233
+
```
234
+
235
+
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