Skip to content
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

feat: add asn logging. Fixes #3907 #3913

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/mlarchive/utils/jsonlogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ def add_fields(self, log_record, record, message_dict):
log_record.setdefault("cf_connecting_ip", record.args["{cf-connecting-ip}i"])
log_record.setdefault("cf_connecting_ipv6", record.args["{cf-connecting-ipv6}i"])
log_record.setdefault("cf_ray", record.args["{cf-ray}i"])
log_record.setdefault("asn", record.args["{x-ip-src-asnum}i"])
7 changes: 5 additions & 2 deletions k8s/nginx-logging.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Define JSON log format - must be loaded before config that references it
# Define JSON log format - must be loaded before config that references it.
# Note that each line is fully enclosed in single quotes. Commas in arrays are
# intentionally inside the single quotes.
log_format ietfjson escape=json
'{'
'"time":"$${keepempty}time_iso8601",'
Expand All @@ -16,5 +18,6 @@ log_format ietfjson escape=json
'"x_forwarded_proto":"$${keepempty}http_x_forwarded_proto",'
'"cf_connecting_ip":"$${keepempty}http_cf_connecting_ip",'
'"cf_connecting_ipv6":"$${keepempty}http_cf_connecting_ipv6",'
'"cf_ray":"$${keepempty}http_cf_ray"'
'"cf_ray":"$${keepempty}http_cf_ray",'
'"asn":"$${keepempty}http_x_ip_src_asnum"'
'}';
Loading