The default location of logs is /var/log/memgraph/memgraph.log but it can be changed using the --log-file configuration flag.

Memgraph tracks logs at various levels: TRACE, DEBUG, INFO, WARNING, ERROR, CRITICAL. By default, it is using the WARNING level, but you can change the level using the --log-level configuration file or during runtime using the SET DATABASE SETTING "log.level" TO "WARNING";

The configuration set during runtime will be applied only for that session.

You can check the log level by running SHOW DATABASE SETTING "log.level"; query.

If you are using Memgraph Lab, you can access the Logs from the interface if the port 7444 was exposed when running the instance.

Access logs

If you installed Memgraph with Linux, logs can be found in the /var/log/memgraph directory.

If you installed Memgraph using Docker:

Find container ID

Open a new terminal and find the CONTAINER ID of the Memgraph Docker container:

docker ps

Enter the container

Run the following command:

docker exec -it <CONTAINER ID> bash

Be sure to replace the <CONTAINER ID> parameter.

List the /var/log/memgraph directory

Position yourself in the /var/log/memgraph directory.

ls /var/log/memgraph

List the content of the log

To list the content of the log, use the cat /var/log/memgraph/<memgraph_date>.log command.

For example, if the ls command returned memgraph_2022-03-04.log you would list the contents using the following command:

cat /var/log/memgraph/memgraph_2022-03-04.log

Save logs locally

If you want to save the log to your computer, exit the container with CTRL+D or exit, place yourself in a directory where you want to save the copy and run the following command:

docker cp  <CONTAINER ID>:/var/log/memgraph/<memgraph_date>.log <memgraph_date>.log

For example, the following command will make a copy of the memgraph_2022-03-04.log file on the user's desktop:

C:\Users\Vlasta\Desktop>docker cp bb3de2634afe:/var/log/memgraph/memgraph_2022-03-04.log memgraph_2022-03-04.log