Spaces:
Running
Running
Reduce container log noise
Browse files- morgan: skip /health, /sw.js, /assets/*, /favicon.ico
- morgan: switch from "combined" to "tiny" format (no UA/referrer noise)
- Dashboard: poll every 30s instead of 5s
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- health-server.js +8 -3
health-server.js
CHANGED
|
@@ -13,7 +13,11 @@ const PAPERCLIP_PORT = 3100;
|
|
| 13 |
|
| 14 |
// Middleware
|
| 15 |
app.use(cors());
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
app.use(express.json());
|
| 18 |
app.use(express.urlencoded({ extended: true }));
|
| 19 |
|
|
@@ -183,6 +187,7 @@ app.all("/api/*", async (req, res) => {
|
|
| 183 |
|
| 184 |
// Catch-all: proxy /assets/*, /site.webmanifest, /favicon.* and any other
|
| 185 |
// paths Paperclip's UI references with absolute URLs directly to Paperclip.
|
|
|
|
| 186 |
app.all("*", async (req, res) => {
|
| 187 |
const targetUrl = `http://${PAPERCLIP_HOST}:${PAPERCLIP_PORT}${req.url}`;
|
| 188 |
|
|
@@ -775,8 +780,8 @@ function getDashboardHTML() {
|
|
| 775 |
// Initial update
|
| 776 |
updateStatus();
|
| 777 |
|
| 778 |
-
// Update every
|
| 779 |
-
setInterval(updateStatus,
|
| 780 |
</script>
|
| 781 |
</body>
|
| 782 |
</html>`;
|
|
|
|
| 13 |
|
| 14 |
// Middleware
|
| 15 |
app.use(cors());
|
| 16 |
+
// Skip logging for health polling and static assets — too noisy
|
| 17 |
+
app.use(morgan("tiny", {
|
| 18 |
+
skip: (req) => req.path === "/health" || req.path === "/sw.js" ||
|
| 19 |
+
req.path.startsWith("/assets/") || req.path === "/favicon.ico"
|
| 20 |
+
}));
|
| 21 |
app.use(express.json());
|
| 22 |
app.use(express.urlencoded({ extended: true }));
|
| 23 |
|
|
|
|
| 187 |
|
| 188 |
// Catch-all: proxy /assets/*, /site.webmanifest, /favicon.* and any other
|
| 189 |
// paths Paperclip's UI references with absolute URLs directly to Paperclip.
|
| 190 |
+
// Note: /health is handled above and never reaches here.
|
| 191 |
app.all("*", async (req, res) => {
|
| 192 |
const targetUrl = `http://${PAPERCLIP_HOST}:${PAPERCLIP_PORT}${req.url}`;
|
| 193 |
|
|
|
|
| 780 |
// Initial update
|
| 781 |
updateStatus();
|
| 782 |
|
| 783 |
+
// Update every 30 seconds — reduce log noise
|
| 784 |
+
setInterval(updateStatus, 30000);
|
| 785 |
</script>
|
| 786 |
</body>
|
| 787 |
</html>`;
|