Further changes with htpasswd provider

This commit is contained in:
Arthur Barr
2020-12-09 14:52:40 +00:00
committed by Arthur J Barr
parent 4257f6a199
commit ac3dcdd0d0
13 changed files with 258 additions and 121 deletions

View File

@@ -100,6 +100,11 @@ func mirrorQueueManagerErrorLogs(ctx context.Context, wg *sync.WaitGroup, name s
return mirrorLog(ctx, wg, f, fromStart, mf, true)
}
// mirrorHTPasswdLogs starts a goroutine to mirror the contents of the MQ HTPasswd authorization service's log
func mirrorHTPasswdLogs(ctx context.Context, wg *sync.WaitGroup, name string, fromStart bool, mf mirrorFunc) (chan error, error) {
return mirrorLog(ctx, wg, "/var/mqm/errors/mqhtpass.json", false, mf, true)
}
func getDebug() bool {
debug := os.Getenv("DEBUG")
if debug == "true" || debug == "1" {
@@ -124,7 +129,7 @@ func configureLogger(name string) (mirrorFunc, error) {
return false
}
if err != nil {
log.Printf("Failed to unmarshall JSON - %v", msg)
log.Printf("Failed to unmarshall JSON in log message - %v", msg)
} else {
fmt.Println(msg)
}
@@ -142,7 +147,7 @@ func configureLogger(name string) (mirrorFunc, error) {
return false
}
if err != nil {
log.Printf("Failed to unmarshall JSON - %v", err)
log.Printf("Failed to unmarshall JSON in log message - %v", err)
} else {
fmt.Printf(formatBasic(obj))
// fmt.Printf(formatSimple(obj["ibm_datetime"].(string), obj["message"].(string)))

View File

@@ -188,6 +188,13 @@ func doMain() error {
logTermination(err)
return err
}
if *devFlag {
_, err = mirrorHTPasswdLogs(ctx, &wg, name, newQM, mf)
if err != nil {
logTermination(err)
return err
}
}
err = updateCommandLevel()
if err != nil {
logTermination(err)