Skip to content

Latest commit

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date

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 pathCSV column name
pagerefpageRef
startedDateTimestartedDateTime
request.methodrequestMethod
request.urlrequestUrl
request.httpVersionrequestHttpVersion
request.headerSizerequestHeaderSize
request.bodySizerequestBodySize
response.statusresponseStatus
response.content.sizeresponseContentSize
response.content.compressionresponseContentSizeCompression
response.content._transferSizeresponseTransferSize
response.headers.name['content-type']responseContentType
response.headers.name['content-length']responseContentLength
response.headers.name['cache-control']responseCacheControl
timetime
timings.blockedblocked
timings.dnsdns
timings.connectconnect
timings.sslssl
timings.sendsend
timings.waitwait
timings.receivereceive
timings._blocked_queuingblockedqueueing

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

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages