Skip to content

Commit

Permalink
Hide tail errors from logs on log rotation
Browse files Browse the repository at this point in the history
When the log gets rotated in the api or metadata containers our logs
will get polluted with the following messages from the `tail` command:

```
tail: '/var/log/nova/nova-api.log' has become inaccessible: No such file or directory
tail: '/var/log/nova/nova-api.log' has appeared;  following new file
```

To prevent his from happening we will redirect the `stderr` from the
`tail` command into `/dev/null`.
  • Loading branch information
Akrog authored and openshift-merge-bot[bot] committed Jun 20, 2024
1 parent 0270cb6 commit ed8c931
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions pkg/novaapi/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,9 @@ func StatefulSet(
Args: []string{
"--single-child",
"--",
"/usr/bin/tail",
"-n+1",
"-F",
"/var/log/nova/nova-api.log",
"/bin/sh",
"-c",
"/usr/bin/tail -n+1 -F /var/log/nova/nova-api.log 2>/dev/null",
},
Image: instance.Spec.ContainerImage,
SecurityContext: &corev1.SecurityContext{
Expand Down
7 changes: 3 additions & 4 deletions pkg/novametadata/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,9 @@ func StatefulSet(
Args: []string{
"--single-child",
"--",
"/usr/bin/tail",
"-n+1",
"-F",
"/var/log/nova/nova-metadata.log",
"/bin/sh",
"-c",
"/usr/bin/tail -n+1 -F /var/log/nova/nova-metadata.log 2>/dev/null",
},
Image: instance.Spec.ContainerImage,
SecurityContext: &corev1.SecurityContext{
Expand Down

0 comments on commit ed8c931

Please sign in to comment.