Skip to content

Adding stats template with JSON output#467

Open
Napsty wants to merge 2 commits intotinyproxy:masterfrom
Napsty:json-stats
Open

Adding stats template with JSON output#467
Napsty wants to merge 2 commits intotinyproxy:masterfrom
Napsty:json-stats

Conversation

@Napsty
Copy link

@Napsty Napsty commented Dec 15, 2022

This PR adds a very simple yet useful stats template with JSON output.
HTML formatting is not required for a pure JSON output.
The first curly brace is set "twice" on purpose, otherwise Tinyproxy itself thinks a variable needs to be parsed.

Works fine in my environment with version 1.10.0 on Debian Bullseye:

ck@linux:~# grep StatFile /etc/tinyproxy/tinyproxy.conf 
# StatFile: The HTML file that gets sent when a request is made
StatFile "/usr/share/tinyproxy/stats-json.html"

ck@linux:~# curl -H "Host: tinyproxy.stats" http://127.0.0.1:8888
{ "version":"1.10.0", "open":1, "requests":267, "bad":2, "denied":2, "refused":0 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant