Using templates

TS

Formats a time.Time with jodaTime layout

{{TS "dd/MM/yyyy" . }}

will render an event’s @timestamp like 2017-12-31 21:05:02 Local as

31/12/2017

DateFormat

format a time.Time with jodaTime layout

{{DateFormat "dd/MM/YYYY" .datetimefield)}}

will render an event’s datetimefield field value like 2017-12-31 21:05:02 Local as

31/12/2017

Time

converts the textual representation of the datetime string into a time.Time

(Time .txtdatefield)

Now

returns the current local time.

NumFmt

format a number

SafeHTML

use string as HTML

HTMLUnescape

unescape a html string

HTMLEscape

escape a html string

Lower

lowercase a string

Upper

uppercase a string

Trim

trim a string

TrimPrefix

trim a prefix from a string

{{TrimPrefix .stringvaluefield "name "}}

will render an event’s stringvaluefield field value like “name Valere” as

Valere

Int

converts a numeric string value to int

Markdown

renders a markdown string value to html

{{markdown .stringfield}}

_

city : {{_ "city" .location}}

renders

city : Paris

Ago

updated {{ago "%d days ago" (Time .CREATEDDATESTRING)}}

renders

updated 34 days ago

Duration Format

The % character signifies that the next character is a modifier that specifies a particular duration unit. The following is the full list of modifiers supported: