-
Notifications
You must be signed in to change notification settings - Fork 241
for #81: log email_relay events #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
emails/views.py
Outdated
| relay_address.user.email.encode('utf-8') | ||
| ).hexdigest(), | ||
| }) | ||
| logger.info(log_string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like ti should work, but the Fields shows as an empty {} ?
{"Timestamp": 1584630352479602944, "Type": "events", "Logger": "fx-private-relay", "Hostname": "groovetop", "EnvVersion": "2.0", "Severity": 6, "Pid": 98734, "Fields": {}}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you pass in the dict directly instead of json dumping it first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.info({
'event_type': 'email_relay',
'relay_address_id': relay_address.id,
'relay_address': sha256(local_portion.encode('utf-8')).hexdigest(),
'real_address': sha256(
relay_address.user.email.encode('utf-8')
).hexdigest(),
})
has the same result. :( Fields comes up empty:
{"Timestamp": 1584632026345210112, "Type": "events", "Logger": "fx-private-relay", "Hostname": "groovetop", "EnvVersion": "2.0", "Severity": 6, "Pid": 98998, "Fields": {}}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I filed mozilla-services/python-dockerflow#40 for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless/until mozilla-services/python-dockerflow#40 is fixed, I updated this to include a json: prefix so the log formatter won't skip it.
If the fraud pipeline log ingestion can parse this, I think we can merge this as-is, and if that up-stream issue is fixed, I'll update the code here later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Output is now:
{"Timestamp": 1584716908799840000, "Type": "events", "Logger": "fx-private-relay", "Hostname": "groovetop", "EnvVersion": "2.0", "Severity": 6, "Pid": 7487, "Fields": {"msg": "json: {\"event_type\": \"email_relay\", \"relay_address_id\": 18, \"relay_address\": \"cf80cd8aed482d5d1527d7dc72fceff84e6326592848447d2dc0b0e87dfc9a90\", \"real_address\": \"f46fbc15047cae1e3b8f098d125372f713e99d974f57d7c0e7d8a1de691c1733\"}"}}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, learned I can pass extra={} in the logger.info call to make the dictionary values show up in Fields ...
{"Timestamp": 1584720542840398080, "Type": "events", "Logger": "fx-private-relay", "Hostname": "groovetop", "EnvVersion": "2.0", "Severity": 6, "Pid": 9438, "Fields": {"relay_address_id": 18, "relay_address": "cf80cd8aed482d5d1527d7dc72fceff84e6326592848447d2dc0b0e87dfc9a90", "real_address": "f46fbc15047cae1e3b8f098d125372f713e99d974f57d7c0e7d8a1de691c1733", "msg": "email_relay"}}
817366f to
d3206d2
Compare
d3206d2 to
d4c3bc2
Compare
No description provided.