> For the complete documentation index, see [llms.txt](https://docs.lidistat67.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lidistat67.eu/installing-and-configuring-logviewer.md).

# Installing and configuring logviewer

## Installing logviewer

Start by cloning the git repository:

```
git clone https://github.com/modmail-dev/logviewer logviewer
```

Move to the logviewer folder by running:

```
cd logviewer
```

## Configuring logviewer

Start by renaming the env file:

```
mv .env.example .env
```

Then edit it using:

```
nano .env
```

Fill `CONNECTION_URI=` with the MongoDB URI you obtained from [Setting Up MongoDB](/setting-up-mongodb.md). You don't need to edit anything else. Press CTRL+X, type Y, then hit enter to save your changes.

## Starting logviewer

### Using pipenv

Install dependencies by running:

```
pipenv install
```

Run logviewer with:

```
pipenv run bot
```

### Using PM2 (recommended)

{% hint style="warning" %}
You need to use pipenv at least once before using PM2.
{% endhint %}

To start logviewer using pm2 run:

```
pm2 start logviewer.sh --name "logviewer" && pm2 save
```

If this is the first time you're using PM2 and you haven't used it for Modmail you should see a command below "\[PM2] To setup the Startup Script, copy/paste the following command:". Copy and run the command. The command should look like this:

```
sudo env PATH=$PATH:/usr/bin /usr/local/lib/node_modules/pm2/bin/pm2 startup systemd -u ubuntu --hp /home/ubuntu
```

Congratulations! You now have a working Modmail and logviewer.

{% hint style="danger" %}
For any issues before the Installing dependencies step, please contact me (lidistat67). You can ping me in the server and I'll reply ASAP. For any issues during or after the Installing dependencies step, you may also contact the Modmail support team.
{% endhint %}
