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

Commit

Permalink
Tweak triage bot logger levels to debug (#1603)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwnbus committed Apr 20, 2020
1 parent 6b0e09a commit b19005b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions alerts/actions/triage_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ def __init__(self):
token=self._config.mozdef_restapi_token,
)

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

self.registration = [
Expand Down Expand Up @@ -252,19 +252,19 @@ def onMessage(self, alert):

if have_request and should_refresh:
self._oauth_handshake()
logger.info("Performed OAuth handshake")
logger.debug("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.info("Discovered Lambda function name")
logger.debug("Discovered Lambda function name")

dispatch = _dispatcher(self._boto_session)

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

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

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

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.info("Deleting expired duplicate chains")
logger.debug("Deleting expired duplicate chains")
delete_expired_chains(dupchains, cfg["chainValidityWindowHours"])

logger.info("Replaying user responses across valid duplicate chains")
logger.debug("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.info("Sending request to REST API")
logger.debug("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.info("Updating status of alert {}".format(response.identifier))
logger.debug("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.info("Got a message to process")
logger.debug("Got a message to process")
return process(message, metadata, self.api_cfg)

return (message, metadata)

0 comments on commit b19005b

Please sign in to comment.