-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoneline
85 lines (75 loc) · 2.31 KB
/
oneline
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{{- /*
This file is an example for customize journalfmt.
And this file configure journalfmt to
show journal entry in one line mode.
The config file of journalfmt is a file contains only golang template.
Go check the golang template syntax first:
https://pkg.go.dev/text/template
*/ -}}
{{- /*
.timestamp contains a string formatted from `__REALTIME_TIMESTAMP`
by `time.UnixMicro(...).String()`
*/ -}}
{{- printf "%-38s " .timestamp -}}
{{- if eq .PRIORITY "0" -}}
[1;31mEMERGENCY[0m
{{- else if eq .PRIORITY "1" -}}
[1;31mALERT [0m
{{- else if eq .PRIORITY "2" -}}
[1;31mCRITICAL [0m
{{- else if eq .PRIORITY "3" -}}
[1;31mERROR [0m
{{- else if eq .PRIORITY "4" -}}
[1;33mWARNING [0m
{{- else if eq .PRIORITY "5" -}}
[1;34mNOTICE [0m
{{- else if eq .PRIORITY "6" -}}
[1;34mINFO [0m
{{- else if eq .PRIORITY "7" -}}
[1;90mDEBUG [0m
{{- end -}}
{{- print " " -}}
{{- if ne .SYSLOG_IDENTIFIER nil -}}
{{printf "%-8s " .SYSLOG_IDENTIFIER}}
{{- else -}}
{{printf "%-8s " ._COMM}}
{{- end -}}
{{- if ne ._PID nil -}}
{{- $pid := printf "[%s]" ._PID -}}
{{- printf "%-6s " $pid -}}
{{- end -}}
{{- if eq .PRIORITY "0" -}}
[1;31m {{- .MESSAGE -}} [0m
{{- else if eq .PRIORITY "1" -}}
[1;31m {{- .MESSAGE -}} [0m
{{- else if eq .PRIORITY "2" -}}
[1;31m {{- .MESSAGE -}} [0m
{{- else if eq .PRIORITY "3" -}}
[1;31m {{- .MESSAGE -}} [0m
{{- else if eq .PRIORITY "4" -}}
[1;33m {{- .MESSAGE -}} [0m
{{- else if eq .PRIORITY "5" -}}
[1;34m {{- .MESSAGE -}} [0m
{{- else if eq .PRIORITY "6" -}}
[1;34m {{- .MESSAGE -}} [0m
{{- else if eq .PRIORITY "7" -}}
[1;90m {{- .MESSAGE -}} [0m
{{- else -}}
{{- .MESSAGE -}}" +
{{- end -}}
{{- print " " -}}
{{- if ne .extra nil -}}
{{- range $k, $v := .extra -}}
{{$k}}={{$v}} {{- print " " -}}
{{- end -}}
{{- end -}}
{{- if ne .CODE_FILE nil -}}
{{- .CODE_FILE -}}
{{- if ne .CODE_LINE nil -}}
:{{- .CODE_LINE -}}
{{- if ne .CODE_FUNC nil -}}
({{- .CODE_FUNC -}})
{{- end -}}
{{- end -}}
{{- end -}}
{{- print "\n" -}}