Support Monolog 3.x

Created on 14 July 2023, over 1 year ago
Updated 18 July 2023, over 1 year ago

Hi,

We use the Akamai module along with Lagoon logs.

The D10 Akamai module now requires Monolog 3.x.

See:
https://git.drupalcode.org/project/akamai/-/blob/5.x/composer.json#L16
https://github.com/FranceMediasMonde/AkamaiOPEN-edgegrid-php-client/blob...

Merge request (to be reviewed) will follow to make Lagoon Logs compatible with Monolog 3.x.

πŸ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia GuillaumeG

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @GuillaumeG
  • πŸ‡¦πŸ‡ΊAustralia tobybellwood

    Thanks @guillaumeg - I’ll check the MR out once it’s up. IIRC there was something we needed to change for monolog 3, but can’t recall it!

  • @guillaumeg opened merge request.
  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • πŸ‡³πŸ‡ΏNew Zealand bomoko

    Hi @GuillaumeG

    Thanks for the MR, it's greatly appreciated.

    Would you mind expanding a little on why you've removed the `LagoonLogsLogProcessor`?
    Without it seems as though we're not getting a bunch of the fields that are calculated by `transformDataForProcessor`.

    From my side, just to test, I've restored `LagoonLogsLogProcessor` and changed it's invoke signature to `public function __invoke(\Monolog\LogRecord $record) {` and this seems to bring the log details back in line with what the module is currently producing.

    Some more info on this would be super. Thanks!

  • πŸ‡¦πŸ‡ΊAustralia GuillaumeG

    Hi bomoko,

    Thanks a lot for checking the MR.

    I removed LagoonLogsLogProcessor because I was able to get all the fields in the logs (OpenSearch) without this class and could not see any difference when comparing with a previous log entry.

    Happy to restore the file with the changes you proposed if I am missing something, which is surely the case !
    Or feel free to push a commit to my MR directly if you prefer.

  • πŸ‡³πŸ‡ΏNew Zealand bomoko

    Ah, thanks for the clarification!

    I was actually testing locally capturing the udp output with nc - I wonder if there's some weirdness going on downstream.

    This is what I was seeing, in terms of the difference in structure :-

    Without LagoonLogsLogProcessor:

    {
      "@timestamp": "2023-07-16T21:35:20.016453+00:00",
      "@version": 1,
      "host": "8b8e14550172",
      "message": "The file assets://js was not deleted because it does not exist.",
      "type": "project_unset-safe_branch_unset",
      "channel": "file",
      "level": "NOTICE",
      "monolog_level": 250
    }
    

    With LagoonLogsLogProcessor:

    {
      "@timestamp": "2023-07-16T21:29:30.469535+00:00",
      "@version": 1,
      "host": "8b8e14550172",
      "message": "The file assets://js was not deleted because it does not exist.",
      "type": "project_unset-safe_branch_unset",
      "channel": "file",
      "level": "NOTICE",
      "monolog_level": 250,
      "ip": "127.0.0.1",
      "request_uri": "http://drupal10-base.docker.amazee.io/",
      "uid": 0,
      "link": "",
      "application": "drupal"
    }

    Which makes sense because the processor _should_ attach this arbitrary data to the log entry.

    I wonder what's happening that it didn't make a difference for you between the two cases? This is the kind of mystery that keeps me up at night :D

  • πŸ‡¦πŸ‡ΊAustralia tobybellwood

    I've just rerun in opensearch and can confirm that those fields are indeed missing from this branch, so will need readding in

  • πŸ‡¦πŸ‡ΊAustralia GuillaumeG

    Hi @bomoko / tobybellwood,

    Thanks both, I was definitely missing these fields.

    I have re-added the file with some changes to make it work with the LogRecord class.

    Ready for review again.

  • Status changed to Needs review over 1 year ago
  • Status changed to RTBC over 1 year ago
  • πŸ‡³πŸ‡ΏNew Zealand bomoko

    Looking good @GuillaumeG - I've pinned your changes to D10+ only, and we'll release this as a new major version.

  • Status changed to Fixed over 1 year ago
  • πŸ‡³πŸ‡ΏNew Zealand bomoko

    Merging into the new 3.x branch

  • Status changed to Fixed over 1 year ago
Production build 0.71.5 2024