Skip to content

Commit 261f78d

Browse files
committed
feat(logspout): use custom datetime
This commit enables users to specify their own datetime format by supplying the `DATETIME_FORMAT` environment variable when using logspout. If none is supplied, logspout will continue to use `DEIS_DATETIME_FORMAT`.
1 parent 76cd8cf commit 261f78d

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

logspout/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ By default, routes are ephemeral. But if you mount a volume to `/mnt/routes`, th
4848

4949
See [Routes Resource](#routes-resource) for all options.
5050

51+
#### Using a custom timestamp format
52+
53+
By default, logspout will use the timestamp format `2006-01-02T15:04:05MST`. A custom format can be specified by setting the `DATETIME_FORMAT` environment variable.
54+
5155
## HTTP API
5256

5357
### Streaming Endpoints

logspout/logspout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func syslogStreamer(target Target, types []string, logstream chan *Log) {
7373
// HACK: Go's syslog package hardcodes the log format, so let's send our own message
7474
_, err = fmt.Fprintf(conn,
7575
"%s %s[%s]: %s",
76-
time.Now().Format(dtime.DEIS_DATETIME_FORMAT),
76+
time.Now().Format(getopt("DATETIME_FORMAT", dtime.DEIS_DATETIME_FORMAT)),
7777
tag,
7878
pid,
7979
logline.Data)

0 commit comments

Comments
 (0)