Mirror MQ system logs

This commit is contained in:
Arthur Barr
2018-03-05 10:57:05 +00:00
parent 1e0ba3d897
commit e07110108f
2 changed files with 14 additions and 3 deletions

View File

@@ -63,9 +63,15 @@ func formatSimple(datetime string, message string) string {
return fmt.Sprintf("%v %v\n", datetime, message) return fmt.Sprintf("%v %v\n", datetime, message)
} }
func mirrorLogs(ctx context.Context, wg *sync.WaitGroup, name string, fromStart bool, mf mirrorFunc) (chan error, error) { // mirrorSystemErrorLogs starts a goroutine to mirror the contents of the MQ system error logs
func mirrorSystemErrorLogs(ctx context.Context, wg *sync.WaitGroup, mf mirrorFunc) (chan error, error) {
// Always use the JSON log as the source
return mirrorLog(ctx, wg, "/var/mqm/errors/AMQERR01.json", false, mf)
}
// mirrorQueueManagerErrorLogs starts a goroutine to mirror the contents of the MQ queue manager error logs
func mirrorQueueManagerErrorLogs(ctx context.Context, wg *sync.WaitGroup, name string, fromStart bool, mf mirrorFunc) (chan error, error) {
// Always use the JSON log as the source // Always use the JSON log as the source
// Put the queue manager name in quotes to handle cases like name=..
qm, err := mqini.GetQueueManager(name) qm, err := mqini.GetQueueManager(name)
if err != nil { if err != nil {
logDebug(err) logDebug(err)

View File

@@ -84,7 +84,12 @@ func doMain() error {
cancelMirror() cancelMirror()
}() }()
// TODO: Use the error channel // TODO: Use the error channel
_, err = mirrorLogs(ctx, &wg, name, newQM, mf) _, err = mirrorSystemErrorLogs(ctx, &wg, mf)
if err != nil {
logTermination(err)
return err
}
_, err = mirrorQueueManagerErrorLogs(ctx, &wg, name, newQM, mf)
if err != nil { if err != nil {
logTermination(err) logTermination(err)
return err return err