diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-03 15:58:05 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-11 13:46:51 -0700 |
commit | e19499caf53c7da022333b1f354be058955991e8 (patch) | |
tree | 9c39d30f9e357c40d2afad0b38c0c17bdd8b8365 /app | |
parent | d50125a03fffe64cd8976f1c8b2e5b66e5fc5b2d (diff) | |
download | gitlab-ce-e19499caf53c7da022333b1f354be058955991e8.tar.gz |
Format `from` and `to` fields in JSON audit logsh-audit-event-json-log-format-from-and-to
To make it possible to index the `from` and `to` fields with
Elasticsearch and other tools, we need the types to be the same.
Currently they are a mix of boolean and string values.
Part of https://gitlab.com/gitlab-org/gitlab-ee/issues/12599
Diffstat (limited to 'app')
-rw-r--r-- | app/services/audit_event_service.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/services/audit_event_service.rb b/app/services/audit_event_service.rb index 201048aaba5..73f3408a240 100644 --- a/app/services/audit_event_service.rb +++ b/app/services/audit_event_service.rb @@ -35,8 +35,12 @@ class AuditEventService @file_logger ||= Gitlab::AuditJsonLogger.build end + def formatted_details + @details.merge(@details.slice(:from, :to).transform_values(&:to_s)) + end + def log_security_event_to_file - file_logger.info(base_payload.merge(@details)) + file_logger.info(base_payload.merge(formatted_details)) end def log_security_event_to_database |