uselagoon / lagoon

Lagoon, the developer-focused application delivery platform
https://docs.lagoon.sh/
Apache License 2.0
556 stars 148 forks source link

Lagoon Logs project field contains project ID #3174

Open smlx opened 2 years ago

smlx commented 2 years ago

Describe the bug

lagoon-logs indices are being incorrectly named using the project ID instead of the project name.

Notice in the screenshot below that the project field matches the index name.

To Reproduce

Steps to reproduce the behavior:

  1. Look at lagoon-logs-* indices in Opensearch.
  2. See incorrect naming.

Expected behavior

These logs should be named using the same pattern as the container/router etc. logs - using the project name, not the project ID.

Screenshots

Screenshot 2022-06-08 at 08-58-06 Discover - OpenSearch Dashboards

Additional context

The lagoon-logging chart has used the project field to extract the project name for index naming for a long time. The change in behaviour causing project ID to be set in this field must be caused by a fairly recent change in Lagoon?

tobybellwood commented 2 years ago

Had a quick look - seems to be only one event type going to the id e.g.

User deployed backup '91574786833888b496f79b95d0602b23b5192adb344f1639b54208f00439feba' to 'production' on project '11'

All others appear to be going to the projectname

Will look at why that useractivitylogger seemingly follows a different pattern to the others https://github.com/uselagoon/lagoon/blob/main/services/api/src/resources/backup/resolvers.ts#L191-L204

tobybellwood commented 2 years ago

ok - found some more:

There are a couple of others that have no project passed, and as a result go into a -__- index:

Anything to do with users, groups, ssh keys etc - can't be linked to a project and should rightfully go into -__- for now

There are a few resticbackup:* - but I think these are double handled also in the api:

shreddedbacon commented 2 years ago

api:deleteEnvironment is actually the deletedeploytarget resolver: https://github.com/uselagoon/lagoon/blob/10a6eb6a2b90b96bdf507975d31e95fbdbfe2114/services/api/src/resources/deploytargetconfig/resolvers.ts#L165