[GH-ISSUE #9301] Add response to logs #6068

Open
opened 2026-04-12 17:23:52 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @The-LittleTeapot on GitHub (Feb 23, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/9301

Hello,
I came across this effort to monitor the usage of our application.

I saw that when making an api call to /api/generate if we set "stream": false the clientside response contains some useful infomation such as:
"total_duration":17810476774,
"load_duration":28360181,
"prompt_eval_count":15,
"prompt_eval_duration":89000000,
"eval_count":494,
"eval_duration":17691000000

However in the application logs this information is nowehere to be found.

Would it be possible to add the response to the application logs?

Originally created by @The-LittleTeapot on GitHub (Feb 23, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/9301 Hello, I came across this effort to monitor the usage of our application. I saw that when making an api call to /api/generate if we set "stream": false the clientside response contains some useful infomation such as: "total_duration":17810476774, "load_duration":28360181, "prompt_eval_count":15, "prompt_eval_duration":89000000, "eval_count":494, "eval_duration":17691000000 However in the application logs this information is nowehere to be found. Would it be possible to add the response to the application logs?
GiteaMirror added the feature request label 2026-04-12 17:23:52 -05:00
Author
Owner

@rick-github commented on GitHub (Feb 23, 2025):

The usage metrics are in the last response if "stream"is true:

$ curl localhost:11434/api/generate -d '{"model":"qwen2.5:0.5b","prompt":"hello"}'
{"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.25836385Z","response":"Hello","done":false}
{"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.261403741Z","response":"!","done":false}
{"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.264514721Z","response":" How","done":false}
{"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.269240164Z","response":" can","done":false}
{"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.27237221Z","response":" I","done":false}
{"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.275536475Z","response":" assist","done":false}
{"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.278710219Z","response":" you","done":false}
{"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.281907137Z","response":" today","done":false}
{"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.285123356Z","response":"?","done":false}
{"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.288154989Z","response":"","done":true,"done_reason":"stop","context":[151644,8948,198,2610,525,1207,16948,11,3465,553,54364,14817,13,1446,525,264,10950,17847,13,151645,198,151644,872,198,14990,151645,198,151644,77091,198,9707,0,2585,646,358,7789,498,3351,30],"total_duration":443910893,"load_duration":384767430,"prompt_eval_count":30,"prompt_eval_duration":24000000,"eval_count":10,"eval_duration":33000000}

ollama doesn't log the response, this is normally done with a proxy or tools like tcpflow or tcpdump.

<!-- gh-comment-id:2677159362 --> @rick-github commented on GitHub (Feb 23, 2025): The usage metrics are in the last response if `"stream"`is true: ```console $ curl localhost:11434/api/generate -d '{"model":"qwen2.5:0.5b","prompt":"hello"}' {"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.25836385Z","response":"Hello","done":false} {"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.261403741Z","response":"!","done":false} {"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.264514721Z","response":" How","done":false} {"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.269240164Z","response":" can","done":false} {"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.27237221Z","response":" I","done":false} {"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.275536475Z","response":" assist","done":false} {"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.278710219Z","response":" you","done":false} {"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.281907137Z","response":" today","done":false} {"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.285123356Z","response":"?","done":false} {"model":"qwen2.5:0.5b","created_at":"2025-02-23T22:42:54.288154989Z","response":"","done":true,"done_reason":"stop","context":[151644,8948,198,2610,525,1207,16948,11,3465,553,54364,14817,13,1446,525,264,10950,17847,13,151645,198,151644,872,198,14990,151645,198,151644,77091,198,9707,0,2585,646,358,7789,498,3351,30],"total_duration":443910893,"load_duration":384767430,"prompt_eval_count":30,"prompt_eval_duration":24000000,"eval_count":10,"eval_duration":33000000} ``` ollama doesn't log the response, this is normally done with a proxy or tools like `tcpflow` or `tcpdump`.
Author
Owner

@The-LittleTeapot commented on GitHub (Feb 25, 2025):

Thanks rick!

this is a new-feature-request.
It would be nice to have this information in the application logs.

<!-- gh-comment-id:2681649917 --> @The-LittleTeapot commented on GitHub (Feb 25, 2025): Thanks rick! this is a new-feature-request. It would be nice to have this information in the application logs.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#6068