Reading Ollama logs and enabling debug output: when a shared server needs answers
When a shared Ollama server is slow, a GPU goes missing or a model refuses to load, the first question is what the server logged. The log is the record of what Ollama found at start-up, which GPUs it discovered, how it sized and loaded each model and what happened to requests it could not serve. Teams running Ollama as a shared service should know where that record lives before an incident, because the answer to the first question depends on the platform: a user session on macOS or Windows, a systemd unit on Linux, or the container's standard output in Docker. Confirm the exact location and retention on your own build with the install method you use, since the log path depends on how the service was started.
Start from the server's defaults. Ollama binds to 127.0.0.1 port 11434 unless OLLAMA_HOST changes that, and the local API at localhost:11434 does not require authentication. A server that appears in logs with an unexpected bind address, or that answers requests from machines it should not reach, is a configuration problem before it is a model problem. Model files live in ~/.ollama/models on macOS, /usr/share/ollama/.ollama/models on Linux and the .ollama\models folder on Windows, unless OLLAMA_MODELS moves them. When a model fails to load because of a missing file or a full disk, the path in the log shows which storage location the server actually used, which is often not the one an administrator expected.
Turn on OLLAMA_DEBUG only when the default log does not explain the symptom, and turn it off afterward. Debug output adds detail about GPU discovery and model load decisions, which is the level you need when a GPU is not detected or a model falls back to the CPU. It also produces more volume on a busy server, so set it for a bounded investigation window and record the Ollama version in the ticket. Before you ship logs to a central system such as Grafana Loki, confirm with your security team what prompt or user content could appear in them, because a shared server log can capture request details that should stay inside a controlled store. Keep the pillar's point in mind: Ollama says it does not see your prompts when it runs locally, but your own logging pipeline is a separate decision you own.
Where Ollama writes logs on each platform and in containers
On Linux, a standard installation typically runs Ollama as a systemd service, so the server log is written to the systemd journal. You read it with journal tools for the service unit rather than opening a log file directly. Confirm the unit name, the environment file layout and the exact commands against the documentation for your installed version and the Ollama FAQ.
- Journal output: Running
journalctl -u ollamashows the service log, and adding-ffollows new lines as they arrive. Confirm the unit name on your install first. - Time windows: Journal time filters let you narrow output to the minutes around a failed request or a GPU error, which keeps load messages easy to find.
- Environment overrides: Variables such as
OLLAMA_DEBUGbelong in the service environment, so check how your install passes them to the unit before restarting. - Read access: Your administrative account needs permission to read journal entries for system services, so confirm group membership on shared hosts.
- Restart boundaries: Each restart begins a new run of log output, so capture the journal before restarting a server that is failing.
Before you rely on this in a runbook, check that the unit name, journal access and environment handling match your installation.
On macOS, Ollama runs for the signed-in user, either as the desktop application or as a process started from a terminal. The place where the server log appears depends on how the server was launched, so the first step is to identify the start method on each host. Confirm the current log location for your version in the Ollama FAQ before you write collection procedures.
- Launch method: Logs from the desktop application and from a server started in a terminal are not necessarily in the same place, so record how each host runs Ollama.
- Terminal capture: Running
ollama servein a terminal sends server output to that terminal, which is the simplest way to watch debug messages during a test. - Persistent record: Redirect terminal output to a file with shell redirection when you need a record that outlives the session.
- User scope: Logs belong to the user session that started Ollama, so a shared server run under another account needs that account's output.
- Model location: Models are stored in
~/.ollama/modelsby default, which helps you connect disk and load events to the model involved.
Before relying on any path, confirm it on a test host running the same version as production.
On Windows, Ollama runs in the background for the signed-in user, and its server output depends on whether it was started as the desktop application or from a console. A console session gives you the most direct view of server messages. Confirm where your installed version writes its log, and whether it appears in the application, a file or Windows Event Log, against the Ollama FAQ.
- Console runs: Starting the server from PowerShell or Command Prompt sends log lines to that window, which is the easiest place to watch debug output as it happens.
- Saved output: PowerShell output redirection can save console output to a file, so the record survives after the window closes.
- Per-user state: Models are stored in the user's
.ollama\modelsfolder by default, so a service account needs its own profile or a configuredOLLAMA_MODELSlocation. - Lost sessions: Logs from a closed console window are gone unless you redirected them, so plan collection before troubleshooting starts.
- Event tools: Confirm whether your version writes to Windows Event Log before you build alerting on it.
Before relying on a collection method, test it on a host running the same version as production and confirm where the output lands.
In a container, Ollama writes its output to standard output and standard error, so the container runtime holds the log stream rather than a file inside the image. You read the stream with the runtime's log commands, and in an orchestrator you use that platform's log tooling. Check the exact flags for your runtime version, and confirm the image and environment setup against the Ollama FAQ.
- Log stream:
docker logs -f <container>follows live output, and--sincelimits how much history you see. Confirm the flags on your Docker version. - Log driver: The host's logging driver decides where lines are stored, how large they can grow and how long they persist, so review it on each host.
- Recreated containers: Removing and recreating a container discards its log history, so export logs before upgrades or image changes.
- Debug settings: Pass
OLLAMA_DEBUGas a container environment variable, then recreate the container so the setting takes effect. - Orchestrators: In Kubernetes or Compose, read logs through the cluster or project tooling and confirm rotation and retention with the platform team.
Before you depend on container logs for an investigation, confirm the log driver, retention and export method on the actual hosts.
Logging and debug settings and when each fits
This table compares the settings that change how much Ollama writes to its logs and where clients connect during troubleshooting. Read each row as a question: is this for routine operation, a short debugging session, or diagnosing load and queue behavior. The main takeaway is that OLLAMA_DEBUG is for brief, targeted use, and the concurrency variables explain most load and queue messages you will see.
| Setting | What it controls | When it fits | Trade-off to weigh |
|---|---|---|---|
| Default log level | Routine server messages such as startup, model loads and GPU discovery results | Normal operation on a shared server, and the first place to look after a change | Usually enough to diagnose common problems without extra noise |
| OLLAMA_DEBUG | Verbose server output, including more detail on discovery and request handling | Short sessions when a specific failure needs more detail than routine logs show | Adds noise and may expose request detail, so enable briefly and disable afterward |
| OLLAMA_HOST | Address and port the server listens on, default 127.0.0.1:11434 | Confirming which address clients reach when a remote caller cannot connect | Changing the bind address exposes the API, so confirm access controls first |
| OLLAMA_NUM_PARALLEL | Parallel requests served per model, default 1 | Explaining why concurrent requests wait or slow down in load messages | Higher values need more memory per model, so check capacity before raising it |
| OLLAMA_MAX_LOADED_MODELS | How many models stay loaded at once, default 3 times GPU count or 3 on CPU | Seeing model load and unload messages when several models compete for memory | Keeping more models loaded consumes VRAM or RAM and can cause evictions |
| OLLAMA_MAX_QUEUE | Maximum queued requests before the server rejects new ones, default 512 | Matching queue messages and rejected requests to a limit you have configured | A high limit hides overload behind long waits, so confirm what clients expect |
Enable debug output and confirm the messages you need
This sequence turns on Ollama debug output in the process that actually serves requests, captures one reproducible request with its surrounding log lines, and returns the server to normal logging. Each step ends with a check so you know the debug output is coming from the right process before you read it.
Confirm the install method and service manager
The server administrator identifies how Ollama was started: a desktop app, a binary launched by hand, a systemd service on Linux, or a container. Record the start command or unit name, the user the process runs as, and the process ID of the running server. Before you change anything, confirm the log location for your platform in the Ollama FAQ and the install documentation. Done means you can name the process and explain where its environment is defined.
Set OLLAMA_DEBUG in the server environment
Add OLLAMA_DEBUG to the environment of the server process, not to an interactive shell where you run commands. A variable exported in a terminal does not reach a service that started earlier. On systemd, add it through a service override; in a container, set it in the run command or compose file; for a desktop app, follow the vendor's documented method. Confirm the accepted value in the Ollama documentation before you set it. Check: read the running process environment (on Linux, the process entry under /proc or the container configuration) and confirm OLLAMA_DEBUG is present.
Restart the service and verify the new process
Restart the Ollama service or container so the process reads the updated environment, for example with
systemctl restart ollamaon a systemd host. Compare the new process ID and start time with the values you recorded in the first step. Then check the first log lines after startup, which should include the server's configuration and GPU discovery output. If the variable is still missing from the process environment, the override or container setting was not applied and the server must be checked again before you continue.Reproduce the issue with one request
Send a single request to the local API on port 11434 using a model that is already downloaded, so the log window stays small and easy to read. Note the exact time you send it and the model name. Use a request that matches the behavior you are investigating, such as a first call after a restart if you are looking at load times. Check that the log records the incoming request and the model it targets. If the log shows nothing for the request, confirm you are reaching the address the server is bound to before you collect any logs.
Collect the log window around the request
Copy the log lines from shortly before the request through the response, and include the startup lines so GPU discovery and any model load messages are in the same record. Look for the model load entries, the GPU or CPU device the model was placed on, and any error or warning lines near the request time. Run
ollama pswhile the model is loaded to confirm which model is resident and where it is running. Done means you have one file with startup, load and request lines that match your timestamps.Turn debug output off and confirm
Remove OLLAMA_DEBUG from the server environment, restart the service, and confirm the variable is absent from the new process. Debug output can include more detail about requests and the host than normal logs, so ask your security or compliance team how the captured file may be stored and shared before you forward it. Check that the log volume drops after the restart and that the next request no longer produces the detailed lines you captured.
How a request moves from client to server logs and central storage
A client request starts at the Ollama API, which listens on 127.0.0.1:11434 by default or on the address set by OLLAMA_HOST. The server writes its own log to the local host, and that log is the first place to look when a request misbehaves. An optional shipper such as Grafana Alloy, Fluent Bit or the Docker logging driver forwards those lines to Loki, and a reverse proxy sits in front of the API if it is exposed beyond the host. The trust boundary sits at the server host: anything that crosses it needs deliberate access control.
Request path, local log capture and shipping to a central log system.
What GPU discovery and model load messages mean
Most Ollama log questions come down to a few recurring signals: what hardware the server found, how a model was placed in memory, and when requests were held back. Read these together rather than one line at a time, because a single warning often explains a slow response that shows up somewhere else.
GPU discovery at startup
Early in the server log, Ollama reports which accelerators it detected and how much memory each one offers. Operators look for the expected GPU count, the expected model and total VRAM, and whether any device is missing. A GPU that is absent here is absent for every model, so check this block first after any restart, driver update or container change. If the expected device is missing, follow the GPU detection troubleshooting topic.
- Default parallel requests
- 1
CUDA or ROCm library detection
Ollama loads vendor runtime libraries to talk to NVIDIA or AMD hardware. Log lines about these libraries show whether the runtime was found, which version was loaded, and whether it failed to initialize. A library that loads but reports zero devices usually points to a driver or permission mismatch rather than a model problem. Compare the library version against the installed driver, and confirm that the service account can reach the device nodes. Remediation lives in the GPU troubleshooting topic.
Model load and memory allocation
When a model is first requested, the log records how the weights and the context cache were split across devices and system memory. Operators compare the reported allocation with the free VRAM they expect. A model that fits on paper but loads into system memory often means the context length is larger than the card can hold, or another process holds memory. Use this block to decide whether to reduce context, change the model size, or free memory before retesting.
Partial CPU offload
When only some layers fit on the GPU, Ollama places the remaining layers on the CPU. The load log states how many layers went to each device, and the same condition appears in ollama ps as a split between GPU and CPU. Partial offload is the most common cause of a model that answers correctly but generates far more slowly than the hardware should allow. Record the split for each model, then work through the slow-generation topic to decide between a smaller model, a shorter context or more VRAM.
- Default loaded models per GPU
- 3
Queue and concurrency limits
Ollama holds requests when parallel slots or the loaded-model limit are full, and it rejects requests once the queue reaches its configured depth. Log entries about queued work, along with slow time-to-first-token, show whether users are waiting for capacity rather than for generation. Check the values of OLLAMA_NUM_PARALLEL, OLLAMA_MAX_LOADED_MODELS and OLLAMA_MAX_QUEUE against the traffic pattern before changing hardware. For overload and 503 behavior, use the overload topic.
- Default queued requests
- 512
Unload and expiry events
Ollama unloads a model when its keep-alive period ends or when another model needs the memory. An unload entry followed by a fresh load on the next request explains a slow first response that otherwise looks random. Look for repeated load and unload cycles for the same model, which suggest the keep-alive period is shorter than the traffic gap or that two models compete for one GPU. Tune preloading and keep-alive settings with the keep-alive topic, and use ollama stop to free memory deliberately.
Shipping Ollama logs to Loki for a central view
A shared Ollama server needs its logs in one place because the people who investigate a slow model load, a GPU fallback or a burst of errors are rarely the people logged into the host. Local files on each machine are easy to lose when a container is recreated, and they cannot be searched across several Ollama servers at once. Shipping the server's output to a central system lets your team filter by host, model and time window. Grafana Loki is one option that fits this job. It stores compressed log chunks and a label index in object storage, so the cost of a long history depends mostly on the storage you provision.
Choose the Loki deployment mode by daily log volume and team size, not by habit. The monolithic mode runs as a single binary and the Loki documentation puts its practical range at about 20 GB of logs per day. The simple scalable mode separates read, write and backend targets and approaches 1 TB per day, but the Loki documentation says it is being deprecated and will be removed with Loki 4.0, so new builds should plan a path to another mode. The microservices mode is for very large clusters. Retention is disabled by default, so logs are kept indefinitely until you set retention_enabled and define rules in the compactor. Confirm the retention period with your compliance owner before you enable it, because each stream rule is at least 24 hours.
If you run Loki with auth_enabled set to true, every request must carry an X-Scope-OrgID header that names the tenant, which lets you separate logs from different Ollama environments. Loki has no built-in authentication, so place an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of it and enforce SSO there. For the shipper, use Grafana Alloy, which Grafana supports for Loki. Fluent Bit, Fluentd and the Docker logging driver are also accepted, and your choice should follow the host and container setup you already run. Test the pipeline by generating a model load, then confirm the entry appears under the right tenant and labels.
Protecting logs that may contain request detail
Debug output and shipped logs can reveal how people use a shared model server, and sometimes what they asked. The cards below cover the controls that decide who can read those logs, how long they live, and how they travel to a central system.
Scope what debug mode writes
Ollama states that a local run does not expose your prompts or data to Ollama, but that does not settle what your own debug settings write to disk. Turn on OLLAMA_DEBUG in a test environment first, then check the log file for request bodies, model names, client addresses and timing values. Record which fields appear, so the production logging decision rests on evidence rather than assumption.
Treat the local API as unauthenticated
The local Ollama API at localhost:11434 does not require authentication. Anyone who can read the log directory, or reach a log shipper's output, may also be able to see which models were called and from where. Limit read access to the log files and the system account that runs Ollama, and put any network exposure behind an authenticating proxy.
Ollama API authenticationPut an authenticating proxy in front of Loki
Loki has no built-in authentication layer. Its documentation says to run an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of it. Without that layer, anyone who reaches the Loki port can query every stream, including Ollama logs. Confirm that the proxy enforces identity on reads and writes before you point any shipper at it.
Loki authenticationSeparate tenants for log streams
When auth_enabled is true, Loki identifies tenants with the X-Scope-OrgID header on every request. Assign Ollama logs their own tenant so that teams with different data obligations cannot query each other's streams. Confirm that your proxy sets or checks this header, because a client that can choose its own tenant value can read another tenant's data.
Set retention deliberately
Loki retention is disabled by default, so logs are kept indefinitely until retention_enabled is set. Decide how long Ollama logs may exist based on your data rules, then set global, per-tenant or per-stream retention to match. Each stream rule must be at least 24 hours. Remember that retention also applies to backups and object storage copies, which need the same deletion rule.
Encrypt and restrict log transport
Log shippers move request-adjacent detail across the network to the central system. Send logs over TLS, restrict which hosts may connect to the Loki write path, and use dedicated credentials for each shipper. Ask your security team to confirm the transport and credential design, and to review who holds the log storage keys, since object storage access can bypass every query control.
Loki send dataCommon questions about Ollama logs and central logging
Does running Ollama and reading its logs cost money?
Running Ollama on your own hardware does not carry a license fee. Ollama is MIT licensed, and its pricing page states that running models on your own hardware is always unlimited. Paid plans apply to Ollama's cloud models, so the costs in a logging project come from your own infrastructure and labor. Log collection adds compute, disk and object storage costs that scale with log volume and retention. The main one-time cost is the time to configure log access and shipping. Ask any partner for a quote built from a written scope that lists platforms, hosts, the log destination and retention rules.
How long does central Ollama log setup take, and what drives the effort?
The effort depends on a few factors more than on Ollama itself. The main drivers are the number of platforms (Linux services, Docker containers, Windows or macOS workstations), the number of hosts, whether you already run a log shipper and central store, and your retention and access rules. A single Linux server with an existing collector is a small job. A mixed fleet with new storage, tenant separation and an authenticating proxy takes longer. Ask for a timeline that lists each host type and each component to be built, and confirm it against your change calendar.
What does the team need to provide before log shipping starts?
Plan for four inputs before work begins:
- Access to the hosts or container runtime where Ollama runs, with read access to logs
- Service manager rights to edit the Ollama service settings and restart it
- A log destination, such as a Loki instance or another central system, with network paths from each host
- Storage sized for the retention period you choose, plus an owner for access requests
Without the service manager rights, you cannot enable OLLAMA_DEBUG or change the log level, so confirm them early.
Can an internal platform team set this up on its own?
Yes, if the team already operates Linux services, a log shipper and a central log store. Ollama logs are plain text written by the service or container, so the core steps are standard: find the log source, set the service environment, ship the lines and label them by host and service. The harder parts are the ones that touch policy, such as who may read model prompts and errors, how long logs are kept, and how the central store is protected. Teams without that experience often benefit from a short review of the design before rollout.
When should an organization bring in a partner for Ollama logging?
Bring in a partner when the logging design has to satisfy several owners at once, or when the platform is part of a regulated or security-sensitive service. Typical triggers include a mixed fleet of workstations, servers and containers, a requirement to separate tenants or teams in the central store, or a need to place an authenticating proxy in front of the log system. DeployOpen implements and documents these setups inside your own infrastructure under a fixed-scope agreement. It does not issue audit reports or certifications, so keep your auditors involved for any evidence they need.
Is it safe to leave OLLAMA_DEBUG turned on?
Leave debug output off in normal operation and turn it on only for a defined investigation. Debug output adds detail about GPU discovery, model loading and request handling, which helps when a fault is hard to reproduce. That detail can also expose operational information, so the logs need the same access controls as other sensitive system logs. Set a time limit for the investigation, record who enabled it, and restore the normal setting afterward. Confirm the exact variable behavior for your Ollama version against the Ollama FAQ before relying on it.
How do I keep Ollama logs for the retention period without collecting too much?
Start with a written list of what the logs must answer, such as service failures, GPU discovery problems and model load errors, and collect only those streams from the Ollama hosts. Set retention per stream or per tenant rather than one global rule, and keep debug output out of long-term storage unless an investigation requires it. In Loki, retention is disabled by default, so you must enable it deliberately. Review the labels you attach, because high-cardinality labels increase cost. Confirm retention rules with your compliance owner before you set them.
Official sources for Ollama and Loki logging
Start with the Ollama FAQ when you need to confirm which environment variables change server behavior, including the debug setting and the variables that control model storage, concurrency and cloud features. Treat the FAQ as the reference for configuration keys, then check the exact spelling and default of each key against the version you run, because a variable name you copy from an older forum post may no longer match. Record the variables you set on the server so that anyone reading its logs later can see the configuration that produced them.
Use the Ollama GitHub repository and its releases page when a log line or a GPU discovery message does not match what the documentation describes. Release notes are where changes to log wording, GPU detection and driver support usually appear, so match the version in your logs against the release notes before you open a support request. Ollama ships frequently, and the releases page also marks pre-releases such as v0.40.6, which you should not treat as the stable baseline for a shared server unless your change process allows it. Confirm the release you are running with ollama --version before you compare behavior.
For shipping logs off the server, read the Loki send data documentation to choose a log shipper that matches your environment, then the Loki deployment modes documentation to size the backend. The deployment modes page notes that simple scalable mode is being deprecated, so confirm the mode you plan against the current Loki release before you build. Ask the team that will run the pipeline to confirm which Loki version they will deploy and how long log retention must last, since both decide where Ollama log lines are stored.
How DeployOpen scopes and supports Ollama logging
DeployOpen plans and implements Ollama logging inside the infrastructure you control, from log locations and debug settings through to central shipping. Each engagement starts with a written scope so the log sources, retention needs and handover deliverables are agreed before any configuration changes are made.
How we scope
- Inventory every Ollama host, container and service unit that needs log capture and confirm where each one writes output.
- Agree in writing whether OLLAMA_DEBUG stays off in production or is enabled for defined troubleshooting windows.
- Confirm which log destination your team already runs and whether a central system is in scope for this engagement.
How we build
- Configure log output for systemd, Docker or Windows hosts so GPU discovery and model load messages can be read.
- Test the debug setting and log shipping pipeline on a staging host before changing the shared production server.
- Verify that log shipping and any reverse proxy in front of the API keep sensitive prompt content out of stored logs.
How we hand over
- Deliver a written runbook that maps common GPU discovery and model load messages to the next diagnostic step.
- Document where logs live, how to enable and disable debug output, and who is allowed to change the setting.
- Walk your operations team through the runbook and confirm they can find and read the relevant log lines unaided.
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
- Ongoing support, upgrades and continuous testing are available as a retainer if your Ollama server changes over time.
- Ask for a quote based on the written scope, since DeployOpen does not publish a price list.

