write unixgram xxxx: sendmsg: no such file or directory
tiechui1994 opened this issue · 3 comments
tiechui1994 commented
on ubuntu16.04, I run the code:
import (
"flag"
"fmt"
"os"
"os/exec"
"time"
"github.com/coreos/go-systemd/journal"
)
func Exec() {
for {
time.Sleep(5 * time.Second)
err := journal.Send("hallo", journal.PriInfo, nil)
fmt.Println(err)
}
}
func main() {
Exec()
}
the output is:
write unixgram @00333->/run/systemd/journal/socket: sendmsg: no such file or directory
write unixgram @00333->/run/systemd/journal/socket: sendmsg: no such file or directory
lucab commented
That likely means there is no /run/systemd/journal/socket
in your system.
lucab commented
Additionally, your import path is wrong as it is missing the gomod version, see https://pkg.go.dev/github.com/coreos/go-systemd/v22@v22.3.2/journal.
tiechui1994 commented
thanks