Where does Discourse store and show logs?

When troubleshooting issues or errors with Discourse it is important you look at your logs. Here’s a listing of where they are and what’s in there.

Your site domain

Administration logs shown in the UI

The Discourse admin panel contains several forms of logging:

The Logster web UI

Every Discourse instance ships with a GUI log viewer. It is located at: https://=DOMAIN=/logs

Note: if you are on a hosted plan, this page may be hidden from you. Instead, contact support when you’re getting this kind of issue!

If you’re investigating a mysterious 500 error on the forums, you should always try this spot first!

Select an error line to get details about it. You may be asked to provide the contents of the env and backtrace tabs here on Meta.

The Rails / Unicorn logs

Ruby on Rails contains a very verbose log which is written to disk. Additionally the web server unicorn also logs to disk.

To access:

cd /var/discourse
./launcher enter app
cd /shared/log/rails

This folder contains “unicorn.stderr.log”, “unicorn.stdout.log” and “production.log” in addition to “rotated” log files. You can use standard Unix tools such as less production.log to inspect them.

This folder is also available without entering the container as /var/discourse/shared/standalone/log/rails.

The NGINX logs

Occasionally NGINX logs may contain some extra tips, they are located at:

cd /var/discourse
./launcher enter app
cd /var/log/nginx

The files access.log and error.log will be there as well as a bunch of rotated compressed files. Running less access.log.2.gz will automatically decompress and display the logfile for you.

This directory is also available on the host at /var/discourse/shared/standalone/log/var-log/nginx .

Redis logs

While it is very uncommon to need to see Redis logs, if you do need them, they go into /var/log/redis inside the container and /var/discourse/shared/standalone/log/var-log/redis on the host. The most recent log entries will be in the current file in that directory.

PostgreSQL logs

If you need to consult the database server logs, they’re in /var/log/postgres inside the container and /var/discourse/shared/standalone/log/var-log/postgres on the host; the most recent entries are in the current file in that directory.

「いいね!」 45

Is there any option/console in admin ui to run these command and get logs in web? I do not see any option.

「いいね!」 2

I have also found this log to be useful:

./launcher logs app

This shows any errors during the build process if you don’t know which app to look at.

「いいね!」 7

I don’t have a postgres folder in /var/log/postgres or /var/discourse/shared/standalone/log/var-log/postgres. Is there some configuration I need to make to generate DB logs?

「いいね!」 1

If You’re using a 2 container install or external postgres, then the logs will not be there.

For 2 container install, the logs should be in the
/var/discourse/shared/data/log/var-log/postgres

For external postgres, your logs should be with the managed db provider.

「いいね!」 4

プラグインがリビルド中に障害を引き起こした場合、プラグイン内の特定のエラーを示すログはどこにありますか?

「いいね!」 1

それらは、再構築を実行したターミナルウィンドウ内にあります。ターミナルに十分なスクロールバックがない場合は、再構築中に注意を払う必要があります(または、ロールバックを増やす方法、あるいは後で見つけられる場所にそれを出力する方法を検索する必要があります)。

「いいね!」 1

プレースホルダーがリストで機能しないようです。

「いいね!」 1