[GH-ISSUE #10613] Option to Mask or Remove Logged Queries for Privacy and Log Size Optimization #69041

Closed
opened 2026-05-04 16:59:55 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @ALLMI78 on GitHub (May 8, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/10613

Hi Ollama Team,

First of all, thank you for the great work on the project — it’s an amazing tool!

I’d like to propose a feature that adds a global configuration option (e.g. environment variable or parameter) to either completely remove logged queries from the log files or replace them with a standardized placeholder (e.g. [Query removed for security and privacy reasons]).

Motivation:

There are a few key reasons why this would be beneficial:

  • Privacy and Security: Logged queries may contain sensitive or private data. If users share log files for debugging or support purposes, they might inadvertently expose information they did not intend to.

  • Log Size: Queries can significantly increase the size of log files, especially during intensive usage. This makes logs harder to manage and share.

  • User Control: Currently, all queries are logged by default, but not every user wants their queries stored in logs. Having the option to disable or sanitize this behavior would give users more control over their data and how it’s handled.

Proposed Solution:

Introduce a global setting (e.g. OLLAMA_MASK_LOGGED_QUERIES=true) that, when enabled:

  • either prevents the actual query text from being written to logs, or

  • replaces it with a generic message such as [Query removed for security and privacy reasons].

This would ensure safer handling of potentially sensitive data and help keep log files lean and easier to share.

Thank you for considering this request!

Best regards ;)

Originally created by @ALLMI78 on GitHub (May 8, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/10613 Hi Ollama Team, First of all, thank you for the great work on the project — it’s an amazing tool! I’d like to propose a feature that adds a global configuration option (e.g. environment variable or parameter) to either completely remove logged queries from the log files or replace them with a standardized placeholder (e.g. [Query removed for security and privacy reasons]). Motivation: There are a few key reasons why this would be beneficial: - Privacy and Security: Logged queries may contain sensitive or private data. If users share log files for debugging or support purposes, they might inadvertently expose information they did not intend to. - Log Size: Queries can significantly increase the size of log files, especially during intensive usage. This makes logs harder to manage and share. - User Control: Currently, all queries are logged by default, but not every user wants their queries stored in logs. Having the option to disable or sanitize this behavior would give users more control over their data and how it’s handled. Proposed Solution: Introduce a global setting (e.g. OLLAMA_MASK_LOGGED_QUERIES=true) that, when enabled: - either prevents the actual query text from being written to logs, or - replaces it with a generic message such as [Query removed for security and privacy reasons]. This would ensure safer handling of potentially sensitive data and help keep log files lean and easier to share. Thank you for considering this request! Best regards ;)
GiteaMirror added the feature request label 2026-05-04 16:59:55 -05:00
Author
Owner

@rick-github commented on GitHub (May 8, 2025):

User Control: Currently, all queries are logged by default,

Queries are only logged with OLLAMA_DEBUG=1.

<!-- gh-comment-id:2860895132 --> @rick-github commented on GitHub (May 8, 2025): > User Control: Currently, all queries are logged by default, Queries are only logged with `OLLAMA_DEBUG=1`.
Author
Owner

@ALLMI78 commented on GitHub (May 8, 2025):

True, but you often request that OLLAMA_DEBUG=1 has to be set ;)

<!-- gh-comment-id:2860923998 --> @ALLMI78 commented on GitHub (May 8, 2025): True, but you often request that OLLAMA_DEBUG=1 has to be set ;)
Author
Owner

@rick-github commented on GitHub (May 8, 2025):

Rather than a new variable, perhaps treat OLLAMA_DEBUG as a loglevel rather than a boolean: 0 = normal debugging, 1 = extra debugging excluding queries, 2 = everything.

<!-- gh-comment-id:2860948195 --> @rick-github commented on GitHub (May 8, 2025): Rather than a new variable, perhaps treat OLLAMA_DEBUG as a loglevel rather than a boolean: 0 = normal debugging, 1 = extra debugging excluding queries, 2 = everything.
Author
Owner

@ALLMI78 commented on GitHub (May 8, 2025):

yes something like this ;)

Level | Name | Description

0 | Normal Debugging | Logs basic internal events. Excludes chat/generate/embedding requests. Safe for general debugging.

1 | Extended Debugging | Includes additional internal details. Still excludes sensitive queries.

2 | Full Logging | Logs everything, including full chat/generate/embedding request entries. Use with caution.

workaround powershell:

Get-Content server.log | Where-Object { $_ -notmatch 'msg="(chat|generate|embedding) request"' } | Set-Content redacted-server.log

<!-- gh-comment-id:2861002666 --> @ALLMI78 commented on GitHub (May 8, 2025): yes something like this ;) Level | Name | Description 0 | Normal Debugging | Logs basic internal events. Excludes chat/generate/embedding requests. Safe for general debugging. 1 | Extended Debugging | Includes additional internal details. Still excludes sensitive queries. 2 | Full Logging | Logs everything, including full chat/generate/embedding request entries. Use with caution. workaround powershell: > Get-Content server.log | Where-Object { $_ -notmatch 'msg="(chat|generate|embedding) request"' } | Set-Content redacted-server.log
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#69041