Invalid `status` for failed logins in json structured rails logs.

Summary

The status field for failed logins in the development|production_json.log is 0. This is not a valid HTTP status, so is consistent with the other values in the fields. This also complicates logic for downstream tools that are meant to operate (e.g. monitoring and alerting) based on status codes.

Steps to reproduce

  1. Configure the structured json logs.
  2. Provide invalid credentials to /users/sign_in

What is the current bug behavior?

A 0 is given as the value of the status.

What is the expected correct behavior?

The status should be 200 if that is the value returned to client. A failed login can be tested for as POST to /user/sign_in with a non-302 return value, since 302 is the returned status for successful logins.

Relevant logs and/or screenshots

A failed login results in 2 log entries:

{
  "method": "POST",
  "path": "/users/sign_in",
  "format": "html",
  "controller": "SessionsController",
  "action": "create",
  "status": 0,
  "duration": 79.34,
  "view": 0,
  "db": 9.47,
  "time": "2019-02-27T23:08:04.779Z",
  "params": [
    {
      "key": "utf8",
      "value": "✓"
    },
    {
      "key": "authenticity_token",
      "value": "[FILTERED]"
    },
    {
      "key": "user",
      "value": {
        "login": "test2@localhost",
        "password": "[FILTERED]",
        "remember_me": "1"
      }
    }
  ],
  "remote_ip": "127.0.0.1",
  "user_id": null,
  "username": null,
  "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0",
  "queue_duration": 262.03,
  "correlation_id": "muDpt20NK67"
}
{
  "method": "POST",
  "path": "//users/sign_in",
  "format": "html",
  "controller": "SessionsController",
  "action": "new",
  "status": 200,
  "duration": 854.71,
  "view": 722.57,
  "db": 8.85,
  "time": "2019-02-27T23:08:04.919Z",
  "params": [
    {
      "key": "utf8",
      "value": "✓"
    },
    {
      "key": "authenticity_token",
      "value": "[FILTERED]"
    },
    {
      "key": "user",
      "value": {
        "login": "test2@localhost",
        "password": "[FILTERED]",
        "remember_me": "1"
      }
    }
  ],
  "remote_ip": "127.0.0.1",
  "user_id": null,
  "username": null,
  "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0",
  "queue_duration": 262.03,
  "correlation_id": null
}

Output of checks

This happens on GitLab.com and has been verified with an up-to-date GDK.