1

I am trying to format the datetimestamp in the following log to produce output of:

2021-02-04 14:29:42.248281

Following is what I have tried so far.

Sample log:

E0204 14:29:42.248281 1 reflector.go:127] pkg/mod/k8s.io/client-go@v0.19.3/tools/cache/reflector.go:156: Failed to watch *v1.Role: failed to list *v1.Role: roles.rbac.authorization.k8s.io is forbidden: User "system:serviceaccount:kube-system:replicator" cannot list resource "roles" in API group "rbac.authorization.k8s.io" at the cluster scope

Custom pattern:

K8CUST_DATE %{MONTHNUM}%{MONTHDAY} %{TIME}

Grok:

%{K8CUST_DATE:log_timestamp}%{GREEDYDATA}

Output:

{
    "log_timestamp": "0204 14:29:42.248281"
}

Could you please tell me what is the next step to produce the output of:

{
    "log_timestamp" : 2021-02-04 14:29:42.248281
}
costaparas
  • 5,047
  • 11
  • 16
  • 26
Alex Leong
  • 11
  • 1

0 Answers0