Skip to content

Nooshu/har2csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

har2csv & har2tsv

Convert a HTTP Archive (HAR) file to a CSV (or TSV) using jq. Script heavily inspired by Google's har2csv (which requires node) by Ayman Farhat, and also a passing comment by Andy Davies.

The script ignores fields that are not essential for analyzing requests/responses such as content and those that might carry private information such as cookies.

Usage

Install and run

# Install jq
$ brew install jq

# Clone the repo, make sure scripts are executable
$ chmod +x har2csv.jq
$ chmod +x har2tsv.jq

# Run CSV
$ ./har2csv.jq input.har > output.csv

# Run TSV
$ ./har2tsv.jq input.har > output.tsv

Generating a HAR file from a browser session

Example using Chrome:

  • Open the Dev Tools panel via Ctrl + Shift + i
  • Click the “Network” menu item on the top menu bar of the panel
  • The HTTP session is recorded by default, navigate to the pages / resources you're inspecting
  • Once ready to export the data, right-click anywhere on the list of items in the Network resource list and select “Save all as HAR with content”

Extracted log entry fields

Entry path CSV column name
pageref pageRef
startedDateTime startedDateTime
request.method requestMethod
request.url requestUrl
request.httpVersion requestHttpVersion
request.headerSize requestHeaderSize
request.bodySize requestBodySize
response.status responseStatus
response.content.size responseContentSize
response.content.compression responseContentSizeCompression
response.content._transferSize responseTransferSize
response.headers.name['content-type'] responseContentType
response.headers.name['content-length'] responseContentLength
response.headers.name['cache-control'] responseCacheControl
time time
timings.blocked blocked
timings.dns dns
timings.connect connect
timings.ssl ssl
timings.send send
timings.wait wait
timings.receive receive
timings._blocked_queuing blockedqueueing

Note: Entries that don't match the above fields / paths are not included in the result CSV/TSV files

Useful links

Licence

Unless stated otherwise, the codebase is released under the MIT License. This covers both the codebase and any sample code in the documentation.

About

Convert a har file to a CSV using jq

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages