How to Access and Read Ollama Server Logs on Various Systems

By Priyash Patil | 2 min read | Updated: Aug 02, 2024 4PM UTC

Ollama is a robust tool for managing AI models, but like any software, it may occasionally experience issues that require troubleshooting. Accessing server logs is crucial for diagnosing and resolving these problems. In this guide, we will discuss how to access Ollama server logs on different operating systems and environments, including Mac, Linux, Windows, and containers.

Accessing Ollama Logs on Mac

To view logs on a Mac, open your terminal and run the following command:

cat ~/.ollama/logs/server.log

This command displays the log file content, helping you identify any issues.

Accessing Ollama Logs on Linux

On Linux systems that use systemd, logs can be accessed with the command:

journalctl -u ollama

This command retrieves the systemd service logs for Ollama.

Accessing Ollama Logs in Containers

For Ollama running inside a container, the logs are sent to stdout/stderr. Use the following commands:

docker logs <container-name>

First, identify the container name by running:

docker ps

Then use the docker logs command to fetch and view the logs.

Accessing Ollama Logs on Windows

On Windows, there are several methods to access Ollama logs:

Open Explorer: Press <ctrl>+R, then type:

The most recent server log is found at server.log, while older logs are stored as server-#.log.

Enabling Debug Logging on All Systems

Debug logging provides more information that can be critical in troubleshooting complex issues. Here is how to enable it on different systems.

Mac and Linux:

  1. Quit the running Ollama application.
  2. Set the OLLAMA_DEBUG environment variable:
export OLLAMA_DEBUG=1
ollama serve

Windows:

  1. First, quit the running application from the tray menu.
  2. Open PowerShell and run:
$env:OLLAMA_DEBUG="1"
& "ollama app.exe"

Containers:

When starting the container, set the environment variable:

docker run -e OLLAMA_DEBUG=1 <container-name>

This configuration ensures detailed logs are captured for effective troubleshooting.

Conclusion

Accessing and understanding your server logs is a vital skill for maintaining and troubleshooting Ollama on various operating systems and environments. Follow the methods outlined in this guide to effectively manage your Ollama logs. Enabling debug logging can further assist in diagnosing complex issues.

For more detailed information, visit the Ollama official site.

Keep the Conversation Going

I hope you found this post helpful! If you have any questions or feedback, feel free to reach out. You can also find me on X (Twitter) @priyashpatil for additional insights and updates on my latest content.

Related

Featured on laravel-news.com and benjamincrozat.com.

Optimized image uploads with CKEditor and Laravel

By Priyash Patil on Friday, 03 November 2023

Bootstrap 5 Remove Unused CSS with Vite and PurgeCSS

By Priyash Patil on Wednesday, 17 January 2024

Laravel Vite Deploy Assets to Global CDN

By Priyash Patil on Friday, 19 January 2024

Laravel file upload with validation example

By Priyash Patil on Thursday, 25 January 2024