Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Adjust debug logs to a reasonable level (#1602)
Browse files Browse the repository at this point in the history
  • Loading branch information
arcrose committed Apr 14, 2020
1 parent d0787d6 commit d005603
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
22 changes: 11 additions & 11 deletions alerts/actions/triage_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ def __init__(self):
token=self._config.mozdef_restapi_token,
)

logger.error("Performing initial OAuth Handshake")
logger.info("Performing initial OAuth Handshake")
self._oauth_handshake()
logger.error("Performing initial Lambda function discovery")
logger.info("Performing initial Lambda function discovery")
self._discover_lambda_fn()

self.registration = "*"
Expand All @@ -239,19 +239,19 @@ def onMessage(self, alert):

if have_request and should_refresh:
self._oauth_handshake()
logger.error("Performed OAuth handshake")
logger.info("Performed OAuth handshake")

# Re-discover the lambda function name to invoke periodically.
last_discovery = (datetime.now() - self._last_discovery).total_seconds()
if last_discovery > self._config.l_fn_name_validity_window_seconds:
self._discover_lambda_fn()
logger.error("Discovered Lambda function name")
logger.info("Discovered Lambda function name")

dispatch = _dispatcher(self._boto_session)

if have_request:
logger.error("Attempting to dispatch request")
logger.error(
logger.info("Attempting to dispatch request")
logger.info(
"Alert {} triggered by {}".format(request.alert.value, request.user)
)

Expand All @@ -260,15 +260,15 @@ def onMessage(self, alert):
should_dispatch = True

try:
logger.error("Fetching duplicate chain")
logger.info("Fetching duplicate chain")
chain = _retrieve_duplicate_chain(
self._rest_api_cfg, request.alert, request.user
)
if chain is None:
logger.error("Creating duplicate chain")
logger.info("Creating duplicate chain")
operation = _create_duplicate_chain
else:
logger.error("Updating duplicate chain")
logger.info("Updating duplicate chain")
operation = _update_duplicate_chain
should_dispatch = False

Expand Down Expand Up @@ -314,7 +314,7 @@ def _oauth_handshake(self):
)

if self._person_api_session is None:
logger.Exception("Failed to establish OAuth session")
logger.error("Failed to establish OAuth session")
raise AuthFailure()

self._last_authenticated = datetime.now()
Expand All @@ -329,7 +329,7 @@ def _discover_lambda_fn(self):
]

if len(functions) == 0:
logger.Exception("Failed to discover Lambda function")
logger.error("Failed to discover Lambda function")
raise DiscoveryFailure()

self._lambda_function_name = functions[0].name
Expand Down
4 changes: 2 additions & 2 deletions cron/triage_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ def main():
dupchains = mongo.meteor[DUP_CHAIN_DB]
alerts = mongo.meteor.alerts

logger.error("Deleting expired duplicate chains")
logger.info("Deleting expired duplicate chains")
delete_expired_chains(dupchains, cfg["chainValidityWindowHours"])

logger.error("Replaying user responses across valid duplicate chains")
logger.info("Replaying user responses across valid duplicate chains")
for (chain, status) in updated_chains(dupchains, alerts):
replay_response(alerts, chain, status)

Expand Down
6 changes: 3 additions & 3 deletions mq/plugins/triage_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def update_alert_status(msg: UserResponseMessage, api: RESTConfig):
jwt_auth.set_header_format("Bearer %s")

try:
logger.error("Sending request to REST API")
logger.info("Sending request to REST API")
resp = requests.post(url, json=payload, auth=jwt_auth)
except Exception as ex:
logger.exception("Request failed: {}".format(ex))
Expand All @@ -197,7 +197,7 @@ def process(msg, meta, api_cfg):

response = UserResponseMessage(ident, UserInfo(email, slack), confidence, resp)

logger.error("Updating status of alert {}".format(response.identifier))
logger.info("Updating status of alert {}".format(response.identifier))
update_succeeded = update_alert_status(response, api_cfg)

if not update_succeeded:
Expand All @@ -221,7 +221,7 @@ def __init__(self):

def onMessage(self, message, metadata):
if message["category"] == "triagebot":
logger.error("Got a message to process")
logger.info("Got a message to process")
return process(message, metadata, self.api_cfg)

return (message, metadata)

0 comments on commit d005603

Please sign in to comment.