Skip to content

Commit e7456b8

Browse files
committed
add datasource in macos agent logs
1 parent da77066 commit e7456b8

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

agent/collectors/macos.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package collectors
55

66
import (
77
"bufio"
8+
"os"
89
"os/exec"
910
"path/filepath"
1011

@@ -29,6 +30,11 @@ func getCollectorsInstances() []Collector {
2930
func (d Darwin) SendLogs() {
3031
path := utils.GetMyPath()
3132
collectorPath := filepath.Join(path, "utmstack-collector-mac")
33+
host, err := os.Hostname()
34+
if err != nil {
35+
utils.Logger.ErrorF("error getting hostname: %v", err)
36+
host = "unknown"
37+
}
3238

3339
cmd := exec.Command(collectorPath)
3440

@@ -62,9 +68,11 @@ func (d Darwin) SendLogs() {
6268
continue
6369
}
6470

71+
messageWithHost := config.GetMessageFormated(host, validatedLog)
72+
6573
logservice.LogQueue <- logservice.LogPipe{
6674
Src: string(config.DataTypeMacOs),
67-
Logs: []string{validatedLog},
75+
Logs: []string{messageWithHost},
6876
}
6977
}
7078

0 commit comments

Comments
 (0)