SNO's ColoredLog for Windows/Linux/Mac using GUI/docker

No problem, this is the exact script I’m using right now.

stdbuf -o0 tail -F /volume1/storj/v3/data/node.log /volume1/storj/usb/db/node.log /volume1/storj/drobo/db/node.log | awk '/^==> / {
    if (substr($0, 20, 2) == "v3"   ) a="Syno";
    if (substr($0, 20, 3) == "usb"  ) a="USB";
    if (substr($0, 20, 5) == "drobo") a="Drobo";next} 
    {
      c="";
      if ($0 ~ /download/                ) c="\033[92m";
      if ($0 ~ /upload/                  ) c="\033[36m";
      if ($0 ~ /GET_REPAIR/              ) c="\033[32m";
      if ($0 ~ /PUT_REPAIR/              ) c="\033[94m";
      if ($0 ~ /GET_AUDIT/               ) c="\033[96m";
      if ($0 ~ /delete/                  ) c="\033[93m";
      if ($0 ~ /retain/                  ) c="\033[33m";
      if ($0 ~ /cancel/                  ) c="\033[95m";
      if ($0 ~ /failed|error|ERROR|FATAL/) c="\033[91m";
      line=$0;
      gsub("upload started",          "upload start",   line);
      gsub("download started",        "download start", line);
      gsub("upload canceled",         "upload cancel",  line);
      gsub("download canceled",       "download cancel",line);
      gsub("deleted\t",               "deleted\t\t",    line);
      gsub("About to delete piece id","\tmove to trash",line);
      gsub("Z\t",                     "Z  ",            line);
    }
    {if (line != "") print c a " >\t" line " < " a "\033[0m"}'

If you only want to use a single log for a single node, this would do.

tail -F /volume1/storj/v3/data/node.log | awk '
    {
      c="";
      if ($0 ~ /download/                ) c="\033[92m";
      if ($0 ~ /upload/                  ) c="\033[36m";
      if ($0 ~ /GET_REPAIR/              ) c="\033[32m";
      if ($0 ~ /PUT_REPAIR/              ) c="\033[94m";
      if ($0 ~ /GET_AUDIT/               ) c="\033[96m";
      if ($0 ~ /delete/                  ) c="\033[93m";
      if ($0 ~ /retain/                  ) c="\033[33m";
      if ($0 ~ /cancel/                  ) c="\033[95m";
      if ($0 ~ /failed|error|ERROR|FATAL/) c="\033[91m";
      line=$0;
      gsub("upload started",          "upload start",   line);
      gsub("download started",        "download start", line);
      gsub("upload canceled",         "upload cancel",  line);
      gsub("download canceled",       "download cancel",line);
      gsub("deleted\t",               "deleted\t\t",    line);
      gsub("About to delete piece id","\tmove to trash",line);
      gsub("Z\t",                     "Z  ",            line);
    }
    {print c line "\033[0m"}'

For use with docker logs, you can simply replace the part before the |.
Change this:

tail -F /volume1/storj/v3/data/node.log

to

docker logs --tail 100 -f storagenode 2>&1

I didn’t test these adaptations, so let me know if you run into any issues. I can try to help debug.
Btw, garbage collection (move to trash) only shows if you have the log level set to debug.

Definitely wouldn’t recommend that. Much better to just pipe the docker logs into it and watch the live log update.

If you end the line with \n it may just omit the normal new line you get. So you may need to double up on those to force an added line. You can also try adding a space after it so it isn’t an empty line.

2 Likes