In order for you to view your self-hosted logs, you have to deploy this application. Before you deploy the application, create a config var named MONGO_URI
and put your MongoDB connection URI from the previous section into the value slot. Take the URL of this app after you deploy it and input it as a config var LOG_URL
in the Modmail bot app.
You can automatically update the logviewer in your Heroku account whenever changes are made to this repo.
To enable auto-updates, fork this repo and install the Pull app in your fork. Then go to the Deploy tab in your Heroku account, select GitHub and connect your fork. Turn on auto-deploy for the master branch.
The method of hosting the logviewer depends on your server configurations.
Below are some general instructions to help you get started on a Linux machine.
pip
git
for your systeme.g. on Ubuntu:
shell
sudo apt install software-properties-common python3.9 python3-dev python3-pip
Run the following shell commands:
shell
git clone https://github.com/kyb3r/logviewer
cd logviewer
python3 -m pip install pipenv
pipenv install
cp .env.example .env
Edit the .env
file (e.g. nano .env
) and fill in your MongoDB connection URI.
You can also customize the bind IP and port in the
.env
file.
Then to start the app, run:
shell
pipenv run logviewer
You can verify the logviewer is working by navigating to http://<IP_OF_SERVER>:8000
(if you didn't change the bind IP / port) and should be greeted with the Logviewer main page.
To run the program in the background, you can use screen
. Or you can use a service manager, such as systemd
, which can also auto-restart the logviewer on failure and after system reboot.
We recommend setting up Nginx reverse proxy to port forward external port 80 to your internal logviewer port and cache static web contents (tutorial).
To accept requests from a domain instead of your server IP, simply set an A
/AAAA
record from your DNS record manager that forwards your domain to your server IP.
Protecting your logs with a login (Discord Oauth2 support) is a premium feature, only available to Patrons.
If you can make improvements in the design and presentation of logs, please make a pull request with changes.
This PR adds GitHub Actions workflow to check for proper code linting using black, and build tests for Python 3.8, 3.9. and 3.10 to match Modmail's workflow respectively.
It also bumps python version on the Dockerfile to 3.10 to match Modmail's, and additionally change from slim
to alpine
to further reduce image size.
Image size is reduced by ~50MB based on my testing.
Yes
This PR is also able to be merged alongside my other PR which adds feature enhancements.
This PR adds a new interface with pagination support to view list of recent logs plus a few other fixes.
To customize the amount of logs displayed per page (default is 25), add PAGINATION variable in your env with the amount of logs you want. (I recommend nothing more than 50)
View Demo (Viewable after logging in)
The demo is based on the patreon version of logviewer, some fields are replaced with placeholders on the normal logviewer
To access new log list page, click on the "Logviewer" header on main page. Log list page can be viewed on url set by your LOG_URL_PREFIX
env (Default /logs
)
Yes
Repost of https://github.com/kyb3r/logviewer/pull/64 Sorry I aren’t really familiar with GitHub’s branch/commit system.
In logviewer, the toggle for internal messages only calls a function, and doesn't check the state of the toggle. This can lead to situations where the state of showing internal messages and the toggle state are not correctly showing. This for instance happens when internal messages were on, you click on an image within the thread, then use your browser's "back" function to go back to the transcript. This causes internal messages to be off, but the toggle remains on.
Discord enabled hotlink protection some time back, the system icon will no longer load since the origin is not discord.com
or discordapp.com
https://github.com/kyb3r/logviewer/blob/31a91bbd6ef1513a9b1839e6a521c8c4315e54c3/core/models.py#L34
Example:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://discordapp.com/assets/e8acd7d9bf6207f99350ca9f9e23b168.woff. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://discord.com’).
Caused by: https://github.com/kyb3r/logviewer/blob/c1e85443d36b2ebded48483b18efe34f5ae5ec0d/static/css/logstyle.css#L7
Modmail is a Discord bot that enables server staff to communicate seamlessly with users via a shared inbox, streamlining message exchanges.
GitHub Repositorydiscord discord-api discord-bot discord-modmail modmail modmail-bot python python3