HTTP Logging
Record HTTP requests and responses from TCP port forwards in a format compatible with the VS Code REST Client.
HTTP logging records the requests and responses that pass through your TCP port forwards, so you can debug API calls. It is off by default and you turn it on for each config.
The HTTP logs video shows the desktop logs opened in an editor.
Sensitive data in logs
HTTP logs capture request and response headers and bodies, including authentication tokens, API keys and personal data. Turn logging on only while you debug, sanitize what you share and delete the logs when you finish.
Enabling HTTP logging
Open the actions menu (the menu icon at the end of the row) for the port forward.
Select Enable HTTP Logs. The same item reads Disable HTTP Logs once logging is on.
Optional: select HTTP Logs Settings to change the log options for that config.
The menu shows these items only for TCP forwards. Once logging is on, Open HTTP Logs File opens the log in your external editor or the system app for log files. kftray tries EDITOR, then VISUAL, then the system opener.
Logging starts for new connections. Connections that were open before you turned it on stay unlogged until they reconnect.
Config fields
| Field | Default | Description |
|---|---|---|
http_logs_enabled | false | Turns logging on for the config |
http_logs_max_file_size | 10 MiB | Saved file-size setting, in bytes. Import accepts 1 byte to 100 MiB |
http_logs_retention_days | 7 | Saved retention setting. Import accepts 1 to 365 days |
http_logs_auto_cleanup | true | Saved automatic-cleanup preference |
The current HTTP logger appends to files without applying these size and retention settings. Check disk usage and delete old logs manually.
This example saves a 20 MiB size setting and 14-day retention preference:
{
"alias": "api-debug",
"target": "app=backend,version=v2",
"namespace": "staging",
"local_port": 3000,
"remote_port": 8080,
"context": "my-k8s-cluster",
"workload_type": "pod",
"protocol": "tcp",
"http_logs_enabled": true,
"http_logs_max_file_size": 20971520,
"http_logs_retention_days": 14,
"http_logs_auto_cleanup": true
}Log file location
HTTP logs live in the http_logs folder inside the configuration directory. kftray looks for the directory in this order:
KFTRAY_CONFIG$XDG_CONFIG_HOME/kftray~/.kftray
Each port forward writes its own file, named <config id>_<local port>.http:
Log format
The .http files are plain text. The # lines and ### separators match the VS Code REST Client format. Each request and each response is its own entry.
# ----------------------------------------
# Trace ID: a1b2c3d4
# Request at: 2026-02-09T14:32:15.123+00:00
POST /api/users HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Content-Length: 87
{"email":"[email protected]","name":"Jane Doe","role":"admin"}
###
# ----------------------------------------
# Trace ID: a1b2c3d4
# Response at: 2026-02-09T14:32:15.168+00:00
# Took: 45 ms
HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 156
{"id":"usr_123","email":"[email protected]","name":"Jane Doe","role":"admin"}
###| Part | Detail |
|---|---|
| Trace ID | Links a request to its response |
| Request at, Response at | RFC 3339 timestamps |
| Took | Response time in milliseconds |
| Request line, headers and body | The request as it went through the forward |
| Status line, headers and body | The response as it came back |
kftray decodes response bodies sent with Content-Encoding: gzip, br or a stacked value such as gzip, br. It shows other encodings as received.
The preformatted-response path cuts decoded bodies at 10 MiB and adds a truncation marker. Other response-formatting paths do not share that limit.
Viewing and replaying in kftui
Press V to open the HTTP logs viewer. It has two modes.
List mode is the default:
- It shows all requests with timestamps and status codes.
↑↓move through requests andPageUpPageDownscroll by ten entries.Enteropens the detail view for a request.aturns automatic scrolling for new requests on or off.Esccloses the viewer.
Detail mode shows the full request and response, including headers and body:
↑↓andPageUpPageDownscroll the details.rreplays the selected request. kftui sends it tohttp://localhost:<local_port>of the forward, unless the request path is already a full HTTP URL.Escgoes back to list mode.
Press o to open the log file in your external editor. Request replay exists in kftui only.
Cleanup
Delete old logs manually:
rm ~/.kftray/http_logs/*.httpIf you changed KFTRAY_CONFIG or XDG_CONFIG_HOME, use that directory's http_logs folder instead. HTTP logging can produce large files for busy services, so check disk use now and then.