HAR Output Format
HAR (HTTP Archive) format is a standard format for storing HTTP request/response data. HAR files can be analyzed with browser DevTools, HAR viewers, or other analysis tools.
Usage
# Output HAR to stdout
logget --har --network https://example.com
# Output HAR to file
logget --har --network --output network.har https://example.com
HAR format only includes network data. Use --network with --har.
Output Schemas
When using --har, logget outputs HAR format data following the HTTP Archive specification (version 1.2). The structure is always a single HAR file object, regardless of follow mode.
HAR Structure
{
"log": {
"version": "1.2",
"creator": {
"name": "logget",
"version": "2.0"
},
"pages": [...],
"entries": [
{
"request": {...},
"response": {...},
"timings": {...},
"cache": {...},
"time": 123.45,
"startedDateTime": "2024-10-31T23:00:00.000Z"
}
]
}
}
Field Descriptions
Root Object
log(object, required): The log object containing all HAR data
Log Object
version(string, required): HAR format version (e.g.,"1.2")creator(object, required): Information about the tool that created the HARname(string): Tool name (e.g.,"logget")version(string): Tool version (e.g.,"2.0")
pages(array, optional): Array of page objects representing pages loadedentries(array, required): Array of entry objects representing HTTP requests/responses
Page Object
Represents a page load:
{
"startedDateTime": "2024-10-31T23:00:00.000Z",
"id": "page_1",
"title": "Example Domain",
"pageTimings": {
"onContentLoad": 123.45,
"onLoad": 234.56,
"onDOMContentLoaded": 112.34
}
}
startedDateTime(string, required): Page load start time (ISO 8601)id(string, required): Unique page identifiertitle(string, required): Page titlepageTimings(object, optional): Page timing information
Entry Object
Represents a single HTTP request/response:
{
"startedDateTime": "2024-10-31T23:00:00.000Z",
"time": 123.45,
"request": {
"method": "GET",
"url": "https://example.com/",
"httpVersion": "HTTP/1.1",
"headers": [
{"name": "User-Agent", "value": "Mozilla/5.0..."},
{"name": "Accept", "value": "text/html"}
],
"queryString": [],
"cookies": [],
"headersSize": 234,
"bodySize": 0
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{"name": "Content-Type", "value": "text/html"},
{"name": "Content-Length", "value": "1256"}
],
"cookies": [],
"content": {
"size": 1256,
"mimeType": "text/html"
},
"redirectURL": "",
"headersSize": 345,
"bodySize": 1256
},
"cache": {},
"timings": {
"blocked": 5.12,
"dns": 5.34,
"connect": 10.12,
"ssl": 20.56,
"send": 2.10,
"wait": 30.45,
"receive": 15.67
},
"serverIPAddress": "93.184.216.34",
"connection": "443"
}
Entry Fields
startedDateTime(string, required): Request start time (ISO 8601)time(float, required): Total request time in millisecondsrequest(object, required): Request objectresponse(object, required): Response objectcache(object, optional): Cache informationtimings(object, required): Timing informationserverIPAddress(string, optional): Server IP addressconnection(string, optional): Connection identifier
Request Object
method(string, required): HTTP method (GET, POST, etc.)url(string, required): Request URLhttpVersion(string, required): HTTP version (e.g., "HTTP/1.1")headers(array, required): Array of header objects{name, value}queryString(array, optional): Array of query parameter objects{name, value}cookies(array, optional): Array of cookie objectsheadersSize(integer, optional): Size of request headers in bytesbodySize(integer, optional): Size of request body in bytespostData(object, optional): POST data (for POST requests)
Response Object
status(integer, required): HTTP status codestatusText(string, required): HTTP status text (e.g., "OK", "Not Found")httpVersion(string, required): HTTP versionheaders(array, required): Array of header objects{name, value}cookies(array, optional): Array of cookie objectscontent(object, required): Response contentsize(integer): Content size in bytesmimeType(string): MIME typetext(string, optional): Response body text (may be truncated)
redirectURL(string, optional): Redirect URL if applicableheadersSize(integer, optional): Size of response headers in bytesbodySize(integer, optional): Size of response body in bytes
Timings Object
All timing values are in milliseconds:
blocked(float): Time spent in queuedns(float): DNS lookup timeconnect(float): Connection establishment timessl(float): SSL/TLS handshake time (HTTPS only)send(float): Time to send requestwait(float): Wait time (server processing) - TTFBreceive(float): Time to receive response
-1 indicates that the timing information is not available.
Output Format
HAR format always outputs a complete HAR file structure, even in follow mode. The file contains all network entries captured during the session.
Saving to File
# Save to file
logget --har --network --output network.har https://example.com
# Append to file
logget --har --network --append --output network.har https://example.com
Follow Mode
In follow mode (-f), HAR format still outputs a complete HAR file structure. The file is written incrementally as network requests are captured:
logget -f --har --network https://example.com
Examples
Basic Network Capture
logget --har --network https://example.com
Output:
{
"log": {
"version": "1.2",
"creator": {
"name": "logget",
"version": "2.0"
},
"pages": [
{
"startedDateTime": "2024-10-31T23:00:00.000Z",
"id": "page_1",
"title": "Example Domain",
"pageTimings": {
"onContentLoad": 123.45,
"onLoad": 234.56
}
}
],
"entries": [
{
"startedDateTime": "2024-10-31T23:00:00.000Z",
"time": 123.45,
"request": {
"method": "GET",
"url": "https://example.com/",
"httpVersion": "HTTP/1.1",
"headers": [
{"name": "User-Agent", "value": "Mozilla/5.0..."},
{"name": "Accept", "value": "text/html,application/xhtml+xml"}
],
"queryString": [],
"cookies": [],
"headersSize": 234,
"bodySize": 0
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{"name": "Content-Type", "value": "text/html; charset=UTF-8"},
{"name": "Content-Length", "value": "1256"}
],
"cookies": [],
"content": {
"size": 1256,
"mimeType": "text/html"
},
"redirectURL": "",
"headersSize": 345,
"bodySize": 1256
},
"cache": {},
"timings": {
"blocked": 5.12,
"dns": 5.34,
"connect": 10.12,
"ssl": 20.56,
"send": 2.10,
"wait": 30.45,
"receive": 15.67
}
}
]
}
}
Best Practices
- Use with Network Only: Remember to use
--networkwith--har - File Size: HAR files can grow large; consider filtering if needed
- Privacy: HAR files may contain sensitive data; be careful when sharing
- Analysis Tools: Use browser DevTools or HAR viewers for visual analysis
- Automation: Use HAR format for automated analysis workflows
Viewing HAR Files
Browser DevTools
- Open Chrome/Edge DevTools (F12)
- Go to Network tab
- Click the "Import HAR file" button (or right-click → Load HAR)
- Select your HAR file