From 3d002268c361fe7e3eab156f0dfdbec81fa40de4 Mon Sep 17 00:00:00 2001 From: Andreas Maier Date: Mon, 25 Nov 2019 12:34:46 +0100 Subject: [PATCH] Improved CADF output Details: * Changed the CADF output format to be more consistent with the CADF standard. There are still some TBDs. See --help-format-cadf for details. * Introduced a HMC log message file that classifies a certain set of HMC log messages for CADF. That file currently defines 24 log messages, and has TODOs for 58 more. Signed-off-by: Andreas Maier --- .gitignore | 2 +- config/zhmc_log_messages.yml | 257 +++++++++++++ zhmc_log_forwarder/zhmc_log_forwarder.py | 467 ++++++++++++++++++++--- 3 files changed, 668 insertions(+), 58 deletions(-) create mode 100644 config/zhmc_log_messages.yml diff --git a/.gitignore b/.gitignore index 9fd0770..3d8e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ /ChangeLog /.pytest_cache/ /try/ -/config/ +/.config/ .DS_Store .ipynb_checkpoints/ .coverage diff --git a/config/zhmc_log_messages.yml b/config/zhmc_log_messages.yml new file mode 100644 index 0000000..b1bd513 --- /dev/null +++ b/config/zhmc_log_messages.yml @@ -0,0 +1,257 @@ +--- +# zhmc_log_forwarder HMC log message file +# +# This file defines information about HMC log messages that allows translating +# an HMC log message received from the HMC into a CADF event. +# +# For a list of the possible HMC log messages, see the Help system of a real +# HMC, in section "Introduction" -> "Audit, Event, and Security Log Messages". +# +# For the CADF standard DSP0262, see +# https://www.dmtf.org/sites/default/files/standards/documents/DSP0262_1.0.0.pdf +# +# The data specified for each HMC log message in this file, is: +# * number (string): event-id / number of HMC log message. +# * message (string): message template of HMC log message. +# * action (string): CADF action. See DSP0262 "CADF Action Taxonomy". +# * outcome (string): CADF outcome. See DSP0262 "CADF Outcome Taxonomy". +# * target_type (string): CADF typeURI of target resource. See DSP0262 +# A.2 "CADF Resource Taxonomy". +# * target_class (string): HMC resource class of target resource. See HMS WS +# API book, 'class' property of the data models. Example: 'partition'. +# +# See zhmc_log_forwarder --help-log-message-file for details. + +# HMC version to which this HMC log message file applies +hmc_version: "2.14.1" + +# TODO: Add and classify the following messages: +# 37 A logon occurred in service representative mode +# 38 A logon occurred in product engineering mode +# 40 A logoff occurred +# 115 The {1} profile {0} was created +# 116 The {1} profile {0} was changed +# 117 The {1} profile {0} was upgraded +# 118 The {1} profile {0} was deleted +# 123 A logon occurred in operator mode +# 124 A logon occurred in advanced operator mode +# 125 A logon occurred in access administrator mode +# 126 A logon occurred in system programmer mode +# 136 Local unsuccessful logon detected +# 137 Operations management unsuccessful logon detected +# 138 Remote operations unsuccessful logon detected +# 191 Local unsuccessful logon threshold exceeded +# 192 Operations management unsuccessful logon threshold exceeded +# 193 Remote operations unsuccessful logon threshold exceeded +# 257 Logon by {0} +# 258 Logoff +# 363 DCAF attempt rejected: Bad password used +# 787 Domain security name or password was changed on consoles: {0} +# 859 There have been {0} consecutive failed logon attempts for user {1} +# 864 Root password was updated +# 948 A user password was changed +# 1067 Domain security name or password was changed by console {0} +# 1278 The password for user {0} has changed +# 1324 User {0} has been disabled for {1} minutes because of too many invalid logon attempts +# 1325 User {0} is no longer disabled from logging on +# 5002 Crypto adapter passphrase logon with profile {0} +# 5003 Crypto adapter group passphrase logon with profile {0} +# 5004 Crypto adapter group member passphrase logon with member {0} +# 5005 Crypto adapter smart card logon with profile {0}. Logon key ID: {1}. Card ID: {2} +# 5006 Crypto adapter group smart card logon with profile {0} +# 5007 Crypto adapter group member smart card logon with member {0}. Logon key ID: {1} +# 5008 Crypto adapter logoff for profile {0} +# 5012 Crypto adapter passphrase logon failure with profile {0} +# 5013 Crypto adapter group passphrase logon failure with profile {0} +# 5014 Crypto adapter group member passphrase logon failed for member {0} +# 5015 Crypto adapter smart card logon failure with profile {0}. Card ID: {1} +# 5016 Crypto Adapter Group Smart Card Logon Failure with Profile {0} +# 5017 Crypto Adapter Group Member Smart Card Logon Failed for Member {0} +# 5018 Crypto Adapter Logoff failed +# 5019 Crypto Adapter Change Passphrase Failure with Profile {0} +# 5200 A valid PIN was entered for {0} in {1}. Card ID: {2}, Zone ID: {3} +# 5250 Failure during PIN entry for {0} in {1}. Card ID: {2}, Zone ID: {3} +# 5251 Tried to access a {0} with a blocked PIN. Card ID: {1}, Zone ID: {2}, Operation: {3} +# 5310 Host user ID {0} logged onto host {1} with mixed case password support set to {2} +# 5311 Logoff host {0} +# 5313 Host user ID {0} logged onto group {1} with mixed case password support set to {2} +# 5410 User {0} logon failed for host {1} with mixed case password support set to {2} +# 5412 User {0} logon failed for group {1} with mixed case password support set to {2} +# 5780 A logon key pair was generated on {0} ({1}) +# 5781 A logon key pair generation failure occurred +# 5809 Failure getting crypto adapter logon information.\nError Code: {0} +# 5810 {0} PIN was set or changed on {1}. Card ID: {2}, Card description: {3} +# 5811 Failed to set or change the PIN on {0} +# 5812 The PIN was unblocked on {0}. Card ID: {1}, Card Description: {2} +# 5813 Failure occurred unblocking {0} PIN + +# The HMC log messages that will be recognized by zhmc_log_forwarder +messages: + - + number: '216' + message: "User {0} has logged on in {1} mode" + action: authenticate/logon + outcome: success + target_type: service + target_class: console + - + number: '522' + message: "User {0} attempted to log on with a user identification or password that was not valid" + action: authenticate/logon + outcome: failed + target_type: service + target_class: console + - + number: '687' + message: "User {0} was logged on automatically at the console" + action: authenticate/logon + outcome: success + target_type: service + target_class: console + - + number: '756' + message: "User {0} logged off from a Platform Independent Remote Console (PIRC) at IP address {1}" + action: authenticate/logoff + outcome: success + target_type: service + target_class: console + - + number: '757' + message: "User {0} was logged off from a Platform Independent Remote Console (PIRC) at IP address {1} due to inactivity" + action: authenticate/forced_logoff + outcome: success + target_type: service + target_class: console + - + number: '1279' + message: "User {0} has logged on" + action: authenticate/logon + outcome: success + target_type: service + target_class: console + - + number: '1280' + message: "User {0} has logged off" + action: authenticate/logoff + outcome: success + target_type: service + target_class: console + - + number: '1283' + message: "{0} was forcibly disconnected by Hardware Management Console user {2} on {1}" + action: authenticate/forced_logoff + outcome: success + target_type: service + target_class: console + - + number: '1284' + message: "User {0} of session {1} has forcibly disconnected user {2} of session {3} in order to log on locally" + action: authenticate/forced_logoff + outcome: success + target_type: service + target_class: console + - + number: '1285' + message: "User {0} was not permitted to log on or reconnect since another user is already logged on" + action: authenticate/logon + outcome: failed + target_type: service + target_class: console + - + number: '1286' + message: "User {0} was not permitted to log on since the userid is disabled" + action: authenticate/logon + outcome: failed + target_type: service + target_class: console + - + number: '1287' + message: "User {0} was not permitted to log on since the userid is not allowed remote access" + action: authenticate/logon + outcome: failed + target_type: service + target_class: console + - + number: '1340' + message: "An attempt for user {0} to log on failed" + action: authenticate/logon + outcome: failed + target_type: service + target_class: console + - + number: '1408' + message: "User {0} has {logged on|reconnected} from {2} to session id {4}. The user's maximum role is {5}" + action: authenticate/logon + outcome: success + target_type: service + target_class: console + - + number: '1409' + message: "User {0} has {logged off|disconnected} from session id {2} for the reason: {3}" + action: authenticate/logoff + outcome: success + target_type: service + target_class: console + - + number: '1410' + message: "User {0} of session {1} has forcibly {logged off|disconnected} user {3} of session {4}" + action: authenticate/forced_logoff + outcome: success + target_type: service + target_class: console + - + number: '1691' + message: "User {0} has attempted to log on from location {1} with a user identification or password that was not valid. The user''s maximum role is {2}" + action: authenticate/logon + outcome: failed + target_type: service + target_class: console + - + number: '1692' + message: "An attempt for user {0} to log on from location {1} failed" + action: authenticate/logon + outcome: failed + target_type: service + target_class: console + - + number: '1941' + message: "User {0} has logged on to Web Services API session {1} from location {2}" + action: authenticate/logon + outcome: success + target_type: service + target_class: console + - + number: '1942' + message: "User {0} has logged off from Web Services API session {1} due to {2}" + action: authenticate/logoff + outcome: success + target_type: service + target_class: console + - + number: '2031' + message: "User {0} was not permitted to log on since the userid is disabled due to inactivity" + action: authenticate/logon + outcome: failed + target_type: service + target_class: console + - + number: '2033' + message: "The shared secret key for user {0} has been reset" + action: "TBD(Rene)" + outcome: success + target_type: service + target_class: console + - + number: '2042' + message: "User {0} has logged on to BCPii API session {1} from source {2}" + action: authenticate/logon + outcome: success + target_type: service + target_class: console + - + number: '2043' + message: "User {0} has logged off from BCPii API session {1} due to {2}" + action: authenticate/logoff + outcome: success + target_type: service + target_class: console diff --git a/zhmc_log_forwarder/zhmc_log_forwarder.py b/zhmc_log_forwarder/zhmc_log_forwarder.py index ffda50d..44935cc 100755 --- a/zhmc_log_forwarder/zhmc_log_forwarder.py +++ b/zhmc_log_forwarder/zhmc_log_forwarder.py @@ -19,8 +19,10 @@ from __future__ import print_function import sys +import os import argparse from datetime import datetime +from collections import OrderedDict import textwrap import logging from logging.handlers import SysLogHandler @@ -37,6 +39,7 @@ from dateutil import tz as dateutil_tz import zhmcclient + CMD_NAME = 'zhmc_log_forwarder' PACKAGE_NAME = 'zhmc-log-forwarder' __version__ = pbr.version.VersionInfo(PACKAGE_NAME).release_string() @@ -191,6 +194,18 @@ class ConnectionError(Error): "%Y-%m-%d %H:%M:%S.%f%z" ], }, + "log_message_file": { + "$id": "#/properties/log_message_file", + "type": "string", + "title": "File path of HMC log message file (in YAML format) " + "to be used with the cadf output format. Relative file paths are " + "relative to the directory containing the config file. " + "Invoke with --help-log-message-file for details.", + "default": None, + "examples": [ + "log_message_file.yml" + ], + }, "forwardings": { "$id": "#/properties/forwardings", "type": "array", @@ -359,6 +374,110 @@ class ConnectionError(Error): } +# JSON schema describing the structure of HMC log message files +LOG_MESSAGE_FILE_SCHEMA = { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://example.com/root.json", + "definitions": {}, + "type": "object", + "title": "zhmc_log_forwarder HMC log message file", + "required": [ + "hmc_version", + "messages", + ], + "additionalProperties": False, + "properties": { + "hmc_version": { + "$id": "#/properties/hmc_version", + "type": "string", + "title": "HMC version to which this log message file applies", + "examples": [ + "2.14.1" + ], + }, + "messages": { + "$id": "#/properties/messages", + "type": "array", + "title": "List of recognized HMC log messages", + "items": { + "$id": "#/properties/messages/items", + "type": "object", + "required": [ + "number", + "message", + "action", + "outcome", + "target_type", + "target_class", + ], + "additionalProperties": False, + "properties": { + "number": { + "$id": "#/properties/messages/items/properties/" + "number", + "type": "string", + "title": "event-id / number of HMC log message.", + "examples": [ + "1234" + ], + }, + "message": { + "$id": "#/properties/messages/items/properties/" + "message", + "type": "string", + "title": "message template of HMC log message.", + "examples": [ + "The user {0} logged on." + ], + }, + "action": { + "$id": "#/properties/messages/items/properties/" + "action", + "type": "string", + "title": "CADF action. " + "See DSP0262 'CADF Action Taxonomy'.", + "examples": [ + "authenticate" + ], + }, + "outcome": { + "$id": "#/properties/messages/items/properties/" + "outcome", + "type": "string", + "title": "CADF outcome. " + "See DSP0262 'CADF Outcome Taxonomy'.", + "examples": [ + "success" + ], + }, + "target_type": { + "$id": "#/properties/messages/items/properties/" + "target_type", + "type": "string", + "title": "CADF typeURI of target resource. " + "See DSP0262 A.2 'CADF Resource Taxonomy'.", + "examples": [ + "service" + ], + }, + "target_class": { + "$id": "#/properties/messages/items/properties/" + "target_class", + "type": "string", + "title": "HMC resource class of target resource. " + "See HMS WS API book, 'class' property of the data " + "models.", + "examples": [ + "partition" + ], + }, + }, + }, + } + } +} + + def extend_with_default(validator_class): """ Factory function that returns a new JSON schema validator class that @@ -475,6 +594,135 @@ def load_config_file(self, filepath): val_value=exc.validator_value)) +class LogMessage(object): + """ + An HMC log message with sufficient data to allow producing the + message-specific parts of a CADF event representing the event described by + the log message. + """ + + def __init__(self, number, message, action, outcome, target_type, + target_class): + + #: string: event-id / number of HMC log message + self.number = number + + #: string: message template of HMC log message + self.message = message + + #: string: CADF action + #: See DSP0262 A.3 "CADF Action Taxonomy" + self.action = action + + #: string: CADF outcome + #: See DSP0262 A.4 "CADF Outcome Taxonomy" + self.outcome = outcome + + #: string: typeURI of target resource + #: See DSP0262 A.2 "CADF Resource Taxonomy" + self.target_type = target_type + + #: string: HMC resource class of target resource + #: See HMS WS API book, 'class' property of the data models + #: Example: 'partition' + self.target_class = target_class + + +class LogMessageConfig(dict): + """ + HMC log messages to be used, as loaded from HMC log message file. + """ + + def __init__(self): + + # HMC log message file structure, as a JSON schema. + self._schema = LOG_MESSAGE_FILE_SCHEMA + + # Data from the HMC log message file. + self._data = None + + # Messages from the file, as a dict of LogMessage objects, by + # message number. + self._messages = None + + def __repr__(self): + data = dict(self._data) + return 'LogMessageConfig({!r})'.format(data) + + @property + def messages(self): + """ + The HMC log messages recognized by the the HMC log message file, as a + dict of LogMessage objects, by message number. + """ + return self._messages + + def load_message_file(self, filepath): + """ + Load the HMC log message file (a YAML file) and set the corresponding + attributes of this object. Omitted properties are defaulted to the + defaults defined in the JSON schema. + + Parameters: + + filepath (string): File path of the HMC log message file. + """ + + # Load HMC log message file + try: + with open(filepath, 'r') as fp: + self._data = yaml.safe_load(fp) + except IOError as exc: + raise UserError( + "Cannot load HMC log message file {}: {}". + format(filepath, exc)) + + # Use a validator that adds defaults for omitted parameters + ValidatorWithDefaults = extend_with_default(jsonschema.Draft7Validator) + validator = ValidatorWithDefaults(self._schema) + + # Validate structure of loaded config parms + try: + validator.validate(self._data) + except jsonschema.exceptions.ValidationError as exc: + item_str = '' + for p in exc.absolute_path: + # Path contains list index numbers as integers + if isinstance(p, int): + item_str += '[{}]'.format(p) + else: + if item_str != '': + item_str += '.' + item_str += p + raise UserError( + "HMC log message file {file} contains an invalid item {item}: " + "{msg} (Validation details: Schema item: {schema_item}; " + "Failing validator: {val_name}={val_value})". + format( + file=filepath, + msg=exc.message, + item=item_str, + schema_item='.'.join(exc.absolute_schema_path), + val_name=exc.validator, + val_value=exc.validator_value)) + + # Set up the other attributes + + self._messages = dict() + messages = self._data['messages'] + for m in messages: + number = m['number'] + m_obj = LogMessage( + number=number, + message=m['message'], + action=m['action'], + outcome=m['outcome'], + target_type=m['target_type'], + target_class=m['target_class'] + ) + self._messages[number] = m_obj + + class HelpConfigFileAction(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): @@ -524,6 +772,11 @@ def __call__(self, parser, namespace, values, option_string=None): # Invoke with --help-time-format for details. selflog_time_format: '%Y-%m-%d %H:%M:%S.%f%z' +# File path of HMC log message file (in YAML format) to be used with the +# cadf output format. Relative file paths are relative to the directory +# containing this config file. +log_message_file: zhmc_log_messages.yml + # List of log forwardings. A log forwarding mainly defines a set of logs to # collect, and a destination to forward them to. forwardings: @@ -572,6 +825,47 @@ def __call__(self, parser, namespace, values, option_string=None): sys.exit(2) +class HelpLogMessageFileAction(argparse.Action): + + def __call__(self, parser, namespace, values, option_string=None): + print("""--- +# HMC log message file for the zhmc_log_forwarder command, in YAML format. +# +# This file defines information about HMC log messages that allows translating +# an HMC log message received from the HMC into a CADF event. +# +# For a list of the possible HMC log messages, see the Help system of a real +# HMC, in section "Introduction" -> "Audit, Event, and Security Log Messages". +# +# For the CADF standard DSP0262, see +# https://www.dmtf.org/sites/default/files/standards/documents/DSP0262_1.0.0.pdf +# +# The data specified for each HMC log message in this file, is: +# * number (string): event-id / number of HMC log message. +# * message (string): message template of HMC log message. +# * action (string): CADF action. See DSP0262 "CADF Action Taxonomy". +# * outcome (string): CADF outcome. See DSP0262 "CADF Outcome Taxonomy". +# * target_type (string): CADF typeURI of target resource. See DSP0262 +# A.2 "CADF Resource Taxonomy". +# * target_class (string): HMC resource class of target resource. See HMS WS +# API book, 'class' property of the data models. Example: 'partition'. + +# HMC version to which this HMC log message file applies +hmc_version: "2.14.1" + +# The HMC log messages that will be recognized by zhmc_log_forwarder +messages: + - + number: '216' + message: "User {0} has logged on in {1} mode" + action: authenticate + outcome: success + target_type: service + target_class: console +""") + sys.exit(2) + + class HelpFormatAction(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): @@ -656,38 +950,54 @@ def __call__(self, parser, namespace, values, option_string=None): For output format 'cadf', each log record is formatted as a JSON string that conforms to the CADF standard (DMTF standard DSP0262). +The indentation of the produced JSON, including whether it should be on a +single line, can be controlled with the CADF_JSON_INDENT global variable. + The following is an example log record in 'cadf' output format: - { - "typeURI": "http://schemas.dmtf.org/cloud/audit/1.0/event", - "eventTime": "2019-06-22T13:00:00-04:00", - "eventType": "activity", - "action": "authenticate/login", - "initiator": { - "typeURI": "data/security/account/user", - "name": "exampleuser@ibm.com", - "host": { - "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) \ -AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 \ -Safari/537.36", - "address": "192.168.1.1" - } - }, - "target": { - "id": "12", - "name": "LPAR123", - "type": "Partition" - }, - "observer": { - "id": "target", - "name": "HM-1-Example-Host-Name" - }, - "outcome": "failure", - "reason": { - "reasonType": "HTTP", - "reasonCode": "401" - } - } +{ + "typeURI": "http://schemas.dmtf.org/cloud/audit/1.0/event", + "eventTime": "2019-11-25T12:53:44+0100", + "eventType": "activity", + "action": "authenticate", + "outcome": "success", + "reason": { + "reasonType": "HMC", + "reasonCode": "1941" + }, + "initiator": { + "typeURI": "data/security/account/user", + "name": "zbcInstall" + }, + "target": { + "id": "TBD: HMC resource URI", + "type": "service", + "name": "TBD: HMC resource name" + }, + "observer": { + "id": "TBD", + "name": "wdc04-05.HMC1" + }, + "x_message": { + "number": "1941", + "text": "User zbcInstall has logged on to Web Services API ...", + "variables": [ + [ + "zbcInstall", + "string" + ], + [ + "Sx9feb3000-e9e7-11e9-bf4a-00106f237ab1.5373", + "string" + ], + [ + "10.183.204.141", + "string" + ] + ] + } +} + """) sys.exit(2) @@ -760,6 +1070,10 @@ def parse_args(): '--help-config-file', action=HelpConfigFileAction, nargs=0, help="Show help about the config file format and exit.") + general_opts.add_argument( + '--help-log-message-file', + action=HelpLogMessageFileAction, nargs=0, + help="Show help about the HMC log message file format and exit.") general_opts.add_argument( '--help-format', action=HelpFormatAction, nargs=0, @@ -819,17 +1133,21 @@ class OutputHandler(object): Handle the outputting of log records for a single log forwarding. """ - def __init__(self, config_parms, fwd_parms): + def __init__(self, config_parms, log_message_config, fwd_parms): """ Parameters: config_parms (dict): Configuration parameters, overall. + log_message_config (LogMessageConfig): HMC log messages for CADF + output format, or None for other output formats. + fwd_parms (dict): Configuration parameters for the forwarding. Some of the more relevant fields are: * format: line / cadf - output format """ self.config_parms = config_parms + self.log_message_config = log_message_config self.fwd_parms = fwd_parms self.logger = None @@ -982,7 +1300,6 @@ def output_entries(self, log_entries): table.append(row) sorted_table = sorted(table, key=lambda row: row.time) - dest = self.fwd_parms['dest'] if dest in ('stdout', 'stderr'): dest_stream = getattr(sys, dest) @@ -1019,30 +1336,49 @@ def out_str(self, row): detail_msgs_vars=row.detail_msgs_vars) else: assert format == 'cadf' - out_dict = { - "typeURI": "http://schemas.dmtf.org/cloud/audit/1.0/event", - "eventTime": self.formatted_time(row.time), - "eventType": "activity", - "action": "any", - "initiator": { - "typeURI": "data/security/account/user", - "name": row.user, - }, - "target": { - "id": "TBD", - "name": "TBD", - "type": "TBD", - }, - "observer": { - "id": "TBD", - "name": row.label, - }, - "outcome": row.msg, - "reason": { - "reasonType": "HMC", - "reasonCode": row.id, - } - } + assert isinstance(self.log_message_config, LogMessageConfig) + try: + msg_info = self.log_message_config.messages[row.id] + except KeyError: + msg_info = LogMessage( + number=None, + message=None, + action='unknown', + outcome='unknown', + target_type=None, + target_class=None + ) + out_dict = OrderedDict([ + ("typeURI", "http://schemas.dmtf.org/cloud/audit/1.0/event"), + ("eventTime", self.formatted_time(row.time)), + ("eventType", "activity"), + ("action", msg_info.action), + ("outcome", msg_info.outcome), + ("reason", OrderedDict([ + ("reasonType", "HMC"), + ("reasonCode", row.id), + ])), + ("observer", OrderedDict([ + ("id", "TBD"), + ("name", row.label), + ])), + ("x_message", OrderedDict([ + ("number", row.id), + ("text", row.msg), + ("variables", row.msg_vars), + ])), + ]) + if row.user: + out_dict["initiator"] = OrderedDict([ + ("typeURI", "data/security/account/user"), + ("name", row.user), + ]) + if msg_info.target_type: + out_dict["target"] = OrderedDict([ + ("id", "TBD: HMC resource URI"), + ("type", msg_info.target_type), + ("name", "TBD: HMC resource name"), + ]) out_str = json.dumps(out_dict, indent=CADF_JSON_INDENT) return out_str @@ -1208,6 +1544,16 @@ def main(): since = config.parms['since'] future = config.parms['future'] + log_message_file = config.parms['log_message_file'] + if log_message_file: + if not os.path.isabs(log_message_file): + config_dir = os.path.dirname(args.config_file) + log_message_file = os.path.join(config_dir, log_message_file) + log_message_config = LogMessageConfig() + log_message_config.load_message_file(log_message_file) + else: + log_message_config = None + if since == 'all': begin_time = None since_str = 'all' @@ -1234,6 +1580,12 @@ def main(): "{} starting".format(CMD_NAME)) SELF_LOGGER.info( "{} version: {}".format(CMD_NAME, __version__)) + SELF_LOGGER.info( + "Config file: {file}". + format(file=args.config_file)) + SELF_LOGGER.info( + "HMC log message file for CADF: {file}". + format(file=log_message_file)) SELF_LOGGER.info( "HMC: {host}, Userid: {user}, Label: {label}". format(host=hmc, user=userid, label=label)) @@ -1268,7 +1620,8 @@ def main(): format(name=name, logs=', '.join(logs), dest=dest_str, format=format)) - out_handler = OutputHandler(config.parms, fwd_parms) + out_handler = OutputHandler( + config.parms, log_message_config, fwd_parms) out_handlers.append(out_handler) for log in logs: