feat: add vector integration

This currently is missing a few features:

- global sinks
- logrotation

But works fairly well otherwise.
This commit is contained in:
Jose Diaz-Gonzalez
2021-01-04 00:30:22 -05:00
parent b386783ec8
commit fd85b1f605
15 changed files with 628 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package common
import (
"bufio"
"fmt"
"os"
"strings"
@@ -93,6 +94,21 @@ func LogVerboseQuietContainerLogs(containerID string) {
}
}
// LogVerboseQuietContainerLogs is the verbose log formatter for container logs
func LogVerboseQuietContainerLogsTail(containerID string) {
sc := NewShellCmdWithArgs(DockerBin(), "container", "logs", containerID, "--follow", "--tail", "10")
stdout, _ := sc.Command.StdoutPipe()
sc.Command.Start()
scanner := bufio.NewScanner(stdout)
scanner.Split(bufio.ScanLines)
for scanner.Scan() {
m := scanner.Text()
fmt.Println(m)
}
sc.Command.Wait()
}
// LogWarn is the warning log formatter
func LogWarn(text string) {
fmt.Fprintln(os.Stderr, fmt.Sprintf(" ! %s", text))