Simplify warewulfd logging
- Collapse SEND and RECV logs into INFO. - Add /etc/default/warewulfd Closes #725 Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- Add flag `--build` to `wwctl container copy`. #1378
|
- Add flag `--build` to `wwctl container copy`. #1378
|
||||||
- Add `wwctl clean` to remove OCI cache and overlays from deleted nodes
|
- Add `wwctl clean` to remove OCI cache and overlays from deleted nodes
|
||||||
- Add `wwctl container import --platform`. #1381
|
- Add `wwctl container import --platform`. #1381
|
||||||
|
- Read environment variables from `/etc/default/warewulfd` #725
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
@@ -46,6 +47,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- Updated various shell scripts for POSIX compatibility. #1464
|
- Updated various shell scripts for POSIX compatibility. #1464
|
||||||
- Update `wwctl server` to always run in the foreground #508
|
- Update `wwctl server` to always run in the foreground #508
|
||||||
- Update `wwctl server` to log to stdout rather than a file #503
|
- Update `wwctl server` to log to stdout rather than a file #503
|
||||||
|
- Changed `wwctl server` to use "INFO" for send and receive logs #725
|
||||||
|
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ AssertFileIsExecutable=@BINDIR@/wwctl
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=exec
|
Type=exec
|
||||||
|
EnvironmentFile=-/etc/default/warewulfd
|
||||||
User=root
|
User=root
|
||||||
Group=root
|
Group=root
|
||||||
ExecStart=@BINDIR@/wwctl server
|
ExecStart=@BINDIR@/wwctl server
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ func DaemonInitLogging() error {
|
|||||||
wwlog.SetLogLevel(level)
|
wwlog.SetLogLevel(level)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wwlog.SetLogLevel(wwlog.SERV)
|
wwlog.SetLogLevel(wwlog.INFO)
|
||||||
}
|
}
|
||||||
|
|
||||||
conf := warewulfconf.Get()
|
conf := warewulfconf.Get()
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ func ProvisionSend(w http.ResponseWriter, req *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
wwlog.Recv("hwaddr: %s, ipaddr: %s, stage: %s", rinfo.hwaddr, req.RemoteAddr, rinfo.stage)
|
wwlog.Info("request from hwaddr:%s ipaddr:%s | stage:%s", rinfo.hwaddr, req.RemoteAddr, rinfo.stage)
|
||||||
|
|
||||||
if (rinfo.stage == "runtime" || len(rinfo.overlay) > 0) && conf.Warewulf.Secure {
|
if (rinfo.stage == "runtime" || len(rinfo.overlay) > 0) && conf.Warewulf.Secure {
|
||||||
if rinfo.remoteport >= 1024 {
|
if rinfo.remoteport >= 1024 {
|
||||||
@@ -276,7 +276,7 @@ func ProvisionSend(w http.ResponseWriter, req *http.Request) {
|
|||||||
wwlog.ErrorExc(err, "")
|
wwlog.ErrorExc(err, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
wwlog.Send("%15s: %s", remoteNode.Id(), stage_file)
|
wwlog.Info("send %s -> %s", stage_file, remoteNode.Id())
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if rinfo.compress == "gz" {
|
if rinfo.compress == "gz" {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ func sendFile(
|
|||||||
stat.ModTime(),
|
stat.ModTime(),
|
||||||
fd)
|
fd)
|
||||||
|
|
||||||
wwlog.Send("%15s: %s", sendto, filename)
|
wwlog.Info("send %s -> %s", filename, sendto)
|
||||||
req.Body.Close()
|
req.Body.Close()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ var (
|
|||||||
SECWARN = SetLevelName(31, "SECWARN")
|
SECWARN = SetLevelName(31, "SECWARN")
|
||||||
WARN = SetLevelName(30, "WARN")
|
WARN = SetLevelName(30, "WARN")
|
||||||
ERROUT = SetLevelName(29, "ERROUT")
|
ERROUT = SetLevelName(29, "ERROUT")
|
||||||
SEND = SetLevelName(27, "SEND")
|
|
||||||
RECV = SetLevelName(26, "RECV")
|
|
||||||
SERV = SetLevelName(25, "SERV")
|
SERV = SetLevelName(25, "SERV")
|
||||||
OUT = SetLevelName(22, "OUT")
|
OUT = SetLevelName(22, "OUT")
|
||||||
SECINFO = SetLevelName(21, "SECINFO")
|
SECINFO = SetLevelName(21, "SECINFO")
|
||||||
@@ -206,7 +204,7 @@ func LogCaller(level int, skip int, err error, message string, a ...interface{})
|
|||||||
}
|
}
|
||||||
|
|
||||||
message = logFormatter(logLevel, &rec)
|
message = logFormatter(logLevel, &rec)
|
||||||
if level == INFO || level == RECV || level == SEND || level == OUT {
|
if level == INFO || level == OUT {
|
||||||
fmt.Fprint(logOut, message)
|
fmt.Fprint(logOut, message)
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprint(logErr, message)
|
fmt.Fprint(logErr, message)
|
||||||
@@ -271,14 +269,6 @@ func Serv(message string, a ...interface{}) {
|
|||||||
LogCaller(SERV, 1, nil, message, a...)
|
LogCaller(SERV, 1, nil, message, a...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Recv(message string, a ...interface{}) {
|
|
||||||
LogCaller(RECV, 1, nil, message, a...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Send(message string, a ...interface{}) {
|
|
||||||
LogCaller(SEND, 1, nil, message, a...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Warn(message string, a ...interface{}) {
|
func Warn(message string, a ...interface{}) {
|
||||||
LogCaller(WARN, 1, nil, message, a...)
|
LogCaller(WARN, 1, nil, message, a...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,20 +126,6 @@ func Test_Log(t *testing.T) {
|
|||||||
expect: "SERV : Serv\n",
|
expect: "SERV : Serv\n",
|
||||||
exactMatch: true,
|
exactMatch: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "Recv",
|
|
||||||
msgTypeFunc: Recv,
|
|
||||||
message: "Recv",
|
|
||||||
expect: "RECV : Recv\n",
|
|
||||||
exactMatch: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Send",
|
|
||||||
msgTypeFunc: Send,
|
|
||||||
message: "Send",
|
|
||||||
expect: "SEND : Send\n",
|
|
||||||
exactMatch: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "Warn",
|
name: "Warn",
|
||||||
msgTypeFunc: Warn,
|
msgTypeFunc: Warn,
|
||||||
|
|||||||
Reference in New Issue
Block a user