Matrix-appservice-irc: Please improve severity of some log entries

Created on 23 Oct 2020  路  6Comments  路  Source: matrix-org/matrix-appservice-irc

Is your feature request related to a problem? Please describe.

When setting the log to level "info" (which seems a reasonable level for production systems: You want some generic info, but not all the debug stuff), there are still a lot of log entries, that shouldn't be in a production system. Most notably entries containing plain text conversations. Those should not end up in the log under normal conditions.

Describe the solution you'd like

Please improve the severity of the log levels

Describe alternatives you've considered
Not really.

Additional context
Here's a suggestion
I have only done the relevant changes to the .js files. So this might not work as expected. Consider this as hints!

--- a/src/bridge/IrcBridge.ts
+++ b/src/bridge/IrcBridge.ts
@@ -670,7 +670,7 @@ export class IrcBridge {
             const data = req.getData();
             const dir = data && data.isFromIrc ? "I->M" : "M->I";
             const duration = " (" + req.getDuration() + "ms)";
-            log.info(`[${req.getId()}] [${dir}] ${msg} ${duration}`);
+            log.debug(`[${req.getId()}] [${dir}] ${msg} ${duration}`);
         }

         // SUCCESS
@@ -946,7 +946,7 @@ export class IrcBridge {
             log.error(line);
         }
         else {
-            log.info(line);
+            log.debug(line);
         }
     }

--- a/src/bridge/IrcHandler.ts
+++ b/src/bridge/IrcHandler.ts
@@ -564,7 +564,7 @@ export class IrcHandler {

         const failed = [];
         for (const room of matrixRooms) {
-            req.log.info(
+            req.log.debug(
                 "Relaying in room %s", room.getId()
             );
             try {
--- a/src/bridge/MatrixHandler.ts
+++ b/src/bridge/MatrixHandler.ts
@@ -514,7 +514,7 @@ export class MatrixHandler {
         // for each room (which may be on different servers)
         ircRooms.forEach((room) => {
             if (room.server.claimsUserId(user.getId())) {
-                req.log.info("%s is a virtual user (claimed by %s)",
+                req.log.debug("%s is a virtual user (claimed by %s)",
                     user.getId(), room.server.domain);
                 return;
             }
@@ -771,7 +771,7 @@ export class MatrixHandler {
         * Matrix --> Matrix (Admin room)
         */

-        req.log.info("%s usr=%s rm=%s body=%s",
+        req.log.debug("%s usr=%s rm=%s body=%s",
             event.type, event.sender, event.room_id,
             (event.content.body ? event.content.body.substring(0, 20) : "")
         );
@@ -788,7 +788,7 @@ export class MatrixHandler {
         const servers = this.ircBridge.getServers();
         for (let i = 0; i < servers.length; i++) {
             if (servers[i].claimsUserId(event.sender)) {
-                req.log.info("%s is a virtual user (claimed by %s)",
+                req.log.debug("%s is a virtual user (claimed by %s)",
                     event.sender, servers[i].domain);
                 return BridgeRequestErr.ERR_VIRTUAL_USER;
             }
@@ -849,7 +849,7 @@ export class MatrixHandler {

         ircRooms.forEach((ircRoom) => {
             if (ircRoom.server.claimsUserId(event.sender)) {
-                req.log.info("%s is a virtual user (claimed by %s)",
+                req.log.debug("%s is a virtual user (claimed by %s)",
                     event.sender, ircRoom.server.domain);
                 return;
             }
bug

Most helpful comment

Agreed there are definitely places where we could be less verbose, and the logging of messages is an ongoing problem that needs addressing.

All 6 comments

Agreed there are definitely places where we could be less verbose, and the logging of messages is an ongoing problem that needs addressing.

Please take a look at my suggestion list. They already make logging a lot better for me.

In the end we keep the response times, because those are useful to track. I've removed a lot of the debug noise that we don't care about, and have moved the printing of message bodies to debug, while showing event_ids for incoming messages.

I'll check the logs with the next release and then report back. :)

moved the printing of message bodies to debug

I think you might have missed some?

Dec 01 13:43:24 behemoth matrix-appservice-irc[16035]: 2020-12-01 13:43:24 INFO:IrcBridge [-] PUT http://ip6-localhost:65020/_matrix/client/r0/rooms/!TlGCKLtHPgdBxpwahp%3Aaasg.name/send/m.room.message/m1606830204406.0 (@freenode_Half-Shot:aasg.name) Body: "{\"msgtype\":\"m.text\",\"body\":\"Suspect this was because of https://github.c

Dec 01 13:54:28 behemoth matrix-appservice-irc[16035]: 2020-12-01 13:54:28 INFO:IrcBridge [-] PUT http://ip6-localhost:65020/_matrix/client/r0/rooms/!XCHyEBqWqkQljkcVjF%3Aaasg.name/send/m.room.message/m1606830868859.17 (@freenode_{^_^}:aasg.name) Body: "{\"msgtype\":\"m.notice\",\"body\":\"[nixos-search] @ncfavier pushed to fix-pac

Not sure if it comes from here or from one of the SDKs, in which case I guess it's out of scope.

Annoyingly comes from the matrix-js-sdk, I'll investigate it.

Was this page helpful?
0 / 5 - 0 ratings