Search code examples
dockermemgraphdb

How to access Memgraph logs in Docker after docker stop command?


I've switched from older version (Memgraph 2.5) to new one (Memgraph 2.10.1). Before I used to run Memgraph Platform in docker using docker run -it -p 7687:7687 -p 7444:7444 -p 3000:3000 memgraph/memgraph-platform. Now the documentation suggest to use docker run -p 7687:7687 -p 7444:7444 -p 3000:3000 --name memgraph memgraph/memgraph-platform.

When I run docker stop command I can still see log file

[2023-09-22 13:16:16.187] INFO: [lab] POST /auth/login?dry-run=true - 201 [6 ms]
2023-09-22 13:16:18,214 WARN received SIGTERM indicating exit request
2023-09-22 13:16:18,214 INFO waiting for memgraph, lab to die
[2023-09-22 13:16:18.195] INFO: [lab] POST /auth/login?dry-run=true - 201 [7 ms]
2023-09-22 13:16:18,385 INFO stopped: lab (exit status 0)

Session terminated, killing shell...[2023-09-22 13:16:18.508] [memgraph_log] [warning] Failed to remove the module mgp_networkx from sys.modules
[2023-09-22 13:16:18.512] [memgraph_log] [warning] Failed to remove the module mgp_igraph from sys.modules
[2023-09-22 13:16:18.556] [memgraph_log] [warning] Failed to remove the module json_util from sys.modules
Setting the default backend to "pytorch". You can change it in the ~/.dgl/config.json file or export the DGLBACKEND environment variable.  Valid options are: pytorch, mxnet, tensorflow (all lowercase)
2023-09-22 13:16:20,389 INFO stopped: memgraph (terminated by SIGTERM)
2023-09-22 13:16:20,389 INFO reaped unknown pid 9 (exit status 0)
 ...killed.

But next time I run Memgraph Platform I can't see my old log files. Can I access logfile for Memgraph container that I've stopped?


Solution

  • You can access your logs again via docker logs command. If you stopped your Docker container, run it again using

    docker start <CONTAINER ID/NAME>

    and after that run

    docker logs -f <CONTAINER ID/NAME>

    now you should be able to see your logs