Compare commits

...

2 Commits

Author SHA1 Message Date
4ab5f60b9d Reduce logging from log streaming command
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2025-01-21 12:58:00 +00:00
a8b61f2086 Upgrade various core components
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2025-01-21 12:54:54 +00:00
2 changed files with 8 additions and 9 deletions

View File

@ -21,7 +21,7 @@ services:
# - "127.0.0.1:8222:8222" # - "127.0.0.1:8222:8222"
prometheus: prometheus:
image: docker.io/prom/prometheus:v3.0.1 image: docker.io/prom/prometheus:v3.1.0
# nobody # nobody
user: "65534" user: "65534"
volumes: volumes:

View File

@ -58,10 +58,10 @@ func (r *requester) Query(ctx context.Context, req logs.Request) (<-chan logs.Me
// buildCmd reeturns the equivalent of // buildCmd reeturns the equivalent of
// //
// journalctl -t <namespace>:<name> \ // journalctl -t <namespace>:<name> \
// --output=json \ // --output=json \
// --since=<timestamp> \ // --since=<timestamp> \
// <--follow> \ // <--follow> \
func buildCmd(ctx context.Context, req logs.Request) *exec.Cmd { func buildCmd(ctx context.Context, req logs.Request) *exec.Cmd {
// // set the cursor position based on req, default to 5m // // set the cursor position based on req, default to 5m
since := time.Now().Add(-5 * time.Minute) since := time.Now().Add(-5 * time.Minute)
@ -105,12 +105,12 @@ func streamLogs(ctx context.Context, cmd *exec.Cmd, out io.ReadCloser, msgs chan
// will ensure `out` is closed and all related resources cleaned up // will ensure `out` is closed and all related resources cleaned up
go func() { go func() {
err := cmd.Wait() if err := cmd.Wait(); err != nil {
log.Println("wait result", err) log.Printf("journalctl exited with error: %s", err)
}
}() }()
defer func() { defer func() {
log.Println("closing journal stream")
close(msgs) close(msgs)
}() }()
@ -176,7 +176,6 @@ func parseEntry(entry map[string]string) (logs.Message, error) {
} }
func logErrOut(out io.ReadCloser) { func logErrOut(out io.ReadCloser) {
defer log.Println("stderr closed")
defer out.Close() defer out.Close()
io.Copy(log.Writer(), out) io.Copy(log.Writer(), out)