Mobicoop V3 logging service
Go to file
Fanch 66b6ee5542 Merge branch 'fix_test_install' into 'main'
Fix test install

See merge request v3/service/logger!26
2024-01-24 15:03:50 +00:00
src update packages, use constants 2023-10-31 11:08:39 +01:00
.editorconfig initial commit 2022-12-23 16:36:23 +01:00
.env.dist secure broker 2023-12-18 15:59:26 +01:00
.eslintrc.js lint pretty --check 2023-03-30 10:47:45 +02:00
.gitignore initial commit 2022-12-23 16:36:23 +01:00
.gitlab-ci.yml use node lts image for docker 2024-01-22 16:57:44 +01:00
.prettierignore lint pretty --check 2023-03-30 10:47:45 +02:00
.prettierrc.json lint pretty --check 2023-03-30 10:47:45 +02:00
Dockerfile use node lts image for docker 2024-01-22 16:57:44 +01:00
README.md refactor 2023-06-29 12:24:56 +02:00
docker-compose.yml use health package; use message broker package; add logger logs management 2023-07-20 14:14:09 +02:00
jest-e2e.json initial commit 2022-12-23 16:36:23 +01:00
nest-cli.json use health package; use message broker package; add logger logs management 2023-07-20 14:14:09 +02:00
package-lock.json 0.2.2 2024-01-17 08:16:50 +01:00
package.json 0.2.2 2024-01-17 08:16:50 +01:00
tsconfig.build.json initial commit 2022-12-23 16:36:23 +01:00
tsconfig.json pretty 2024-01-17 08:19:47 +01:00

README.md

Mobicoop V3 - Logger Service

Logging system for all services.

Requirements

You need Docker and its compose plugin.

A RabbitMQ instance is also required to receive messages from other services.

Installation

Copy .env.dist to .env :

cp .env.dist .env

and modify it to suit your needs.

Then execute :

docker compose up -d

The app runs automatically on the port defined in SERVICE_PORT of .env file (default : 5099).

Usage

The app subscribes to RabbitMQ queues in order to log messages. We use the routing key with the given format : <service>.<action>.<level>, with :

  • service : the name of the service that has emitted the message
  • action : the action that triggered the message (one or more words separated by a dot, last word should be a past action)
  • level : the severity (log level) of the message, as described in RFC5424 syslog :
    • emer : Emergency: system is unusable
    • alert : Alert: action must be taken immediately
    • crit : Critical: critical conditions
    • error : Error: error conditions
    • warning : Warning: warning conditions
    • notice : Notice: normal but significant condition
    • info : Informational: informational messages
    • debug : Debug: debug-level messages

Examples of valid routing keys :

  • user.created.info
  • user.created.crit
  • user.updated.warning
  • auth.username.added.info

It is the responsibility of each service to set the routing key to the appropriate value.

To handle logs for a given service, a controller corresponding to the service must be set. In this controller, you must define a handler for each action and level. You must also define a unique RabbitMQ queue for this handler (this permits to use durable queues, allowing to keep logs in RabbitMQ even if the logger service is down).

License

Mobicoop V3 - Logger Service is AGPL licensed.