Skip to main content
Version: 2.5.1

How to change configuration settings and access log files

Related - Reference Guide

This how-to guide will show you how to change configuration settings for Memgraph and check the log files.

Continue reading if you are using Memgraph with Docker, or skip to the Linux chapter if you are using MemgraphDB with WSL, Ubuntu, Debian, or RPM package.

Docker

Below you will find instructions on configuring Memgraph and checking logs if you are using Memgraph with Docker.

Configuring Memgraph

If you want a custom configuration to be in effect every time you run Memgraph, change the main configuration file.

If you want a certain configuration setting to be applied during this run only, pass the configuration option within the docker run command.

Changing the configuration file

Begin with starting Memgraph and finding out the CONTAINER ID:

1. Start Memgraph with a docker run command but be sure to include the following flag -v mg_etc:/etc/memgraph.

2. Open a new terminal and find the CONTAINER ID of the Memgraph Docker container using the following command:

docker ps

Now, you can choose to either modify the main configuration file outside of Docker, or within Docker with a command-line text editor (such as vim).

To change the configuration file outside the Docker container continue with the following steps:

3. Place yourself in the directory where you want to copy the configuration file.

4. Copy the file from the container to your current directory with the command:

docker cp <CONTAINER ID>:/etc/memgraph/memgraph.conf memgraph.conf

Be sure to replace the <CONTAINER ID> parameter.

The example below will copy the configuration file to the user's Desktop:

C:\Users\Vlasta\Desktop>docker cp bb3de2634afe:/etc/memgraph/memgraph.conf memgraph.conf

5. Open the configuration file with a text editor.

6. Modify the configuration file and save the changes.

7. Copy the file from your current directory to the container with the command:

docker cp  memgraph.conf <CONTAINER ID>:/etc/memgraph/memgraph.conf

Be sure to replace the <CONTAINER ID> parameter.

The example below will replace the configuration file with the one from the user's Desktop:

C:\Users\Vlasta\Desktop>docker cp memgraph.conf bb3de2634afe:/etc/memgraph/memgraph.conf

8. Restart Memgraph.

9. You can check the current configuration by running the SHOW CONFIG; query.


Passing configuration options within the docker run command

Select the image you are using to find out how to customize the configuration by passing configuration options within the docker run command.

If you are working with the memgraph-platform image, you should pass configuration options with environment variables.

For example, if you want to limit memory usage for the whole instance to 50 MiB and set the log level to TRACE, pass the configuration like this:

docker run -it -p 7687:7687 -p 3000:3000 -p 7444:7444 -e MEMGRAPH="--memory-limit=50 --log-level=TRACE" memgraph/memgraph-platform

You can check the current configuration by running the SHOW CONFIG; query.

Accessing logs

To access the logs of a running instance:

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

docker ps

2. Run the following command:

docker exec -it <CONTAINER ID> bash

Be sure to replace the <CONTAINER ID> parameter.

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

cd /var/log/memgraph

4. List all the log files with ls.

5. List the content of the log with the cat <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 memgraph_2022-03-04.log

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

docker cp  <memgraph_date>.log <CONTAINER ID>:/var/log/memgraph/<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 memgraph_2022-03-04.log bb3de2634afe:/var/log/memgraph/memgraph_2022-03-04.log.log

Linux

This section of the how-to guide will explain how to change the configuration file and access logs if you are using MemgraphDB with WSL, Ubuntu, Debian or RPM package.

Configuring Memgraph

1. Install and run Memgraph.

2. Open the configuration file available at /etc/memgraph/memgraph.conf.

3. Modify the configuration file and save the changes.

4. Restart Memgraph.

5. You can check the current configuration by running the SHOW CONFIG; query.

Accessing logs

Logs can be found in the /var/log/memgraph directory.