diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-04 01:58:05 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-11 23:46:51 +0300 |
commit | e19499caf53c7da022333b1f354be058955991e8 (patch) | |
tree | 9c39d30f9e357c40d2afad0b38c0c17bdd8b8365 /app/services/audit_event_service.rb | |
parent | d50125a03fffe64cd8976f1c8b2e5b66e5fc5b2d (diff) |
Format `from` and `to` fields in JSON audit log
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/services/audit_event_service.rb')
-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 |