Skip to content

Commit b771b2c

Browse files
authored
Merge pull request #23698 from serathius/blog
Small fixes in structured logging post
2 parents 377ca1f + e2f152a commit b771b2c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

content/en/blog/_posts/2020-09-04-introducing-structured-logs.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
layout: blog
2+
layout: blog
33
title: 'Introducing Structured Logs'
4-
date: 2020-09-04
4+
date: 2020-09-04
55
slug: kubernetes-1-19-Introducing-Structured-Logs
66
---
77

@@ -18,13 +18,13 @@ To maintain backwards compatibility, structured logs will still be outputted as
1818
We've added two new methods to the klog library: InfoS and ErrorS. For example, this invocation of InfoS:
1919

2020
```golang
21-
klog.InfoS(Pod status updated”, “pod, klog.KObj(pod), status, status)
21+
klog.InfoS("Pod status updated", "pod", klog.KObj(pod), "status", status)
2222
```
2323

2424
will result in this log:
2525

2626
```
27-
I1025 00:15:15.525108 1 controller_utils.go:116] "Pod status updated" pod="kube-system/kubedns" status=ready
27+
I1025 00:15:15.525108 1 controller_utils.go:116] "Pod status updated" pod="kube-system/kubedns" status="ready"
2828
```
2929

3030
Or, if the --logging-format=json flag is set, it will result in this output:
@@ -33,11 +33,11 @@ Or, if the --logging-format=json flag is set, it will result in this output:
3333
{
3434
"ts": 1580306777.04728,
3535
"msg": "Pod status updated",
36-
"Pod”: {
37-
“Name”: “kubedns”,
38-
“Namespace”: “kubedns”
36+
"pod": {
37+
"name": "coredns",
38+
"namespace": "kube-system"
3939
},
40-
status”: “ready
40+
"status": "ready"
4141
}
4242
```
4343

0 commit comments

Comments
 (0)