-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhar2csv.jq
executable file
·64 lines (62 loc) · 1.52 KB
/
har2csv.jq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/jq -rMf
# Quickly convert a HTTP Archive file (har) to a CSV file.
# Headers for resulting CSV file
[
"pageRef",
"startedDateTime",
"requestMethod",
"requestUrl",
"requestHttpVersion",
"requestHeaderSize",
"requestBodySize",
"responseStatus",
"responseContentSize",
"responseContentSizeCompression",
"responseTransferSize",
"responseContentType",
"responseContentLength",
"responseCacheControl",
"time",
"blocked",
"dns",
"connect",
"ssl",
"send",
"wait",
"receive",
"blockedqueueing"
],
(
# drill down into the entries data
.log.entries
# convert object into array and extract the value
| to_entries[].value
# pull out the data we want in the CSV
| [
.pageref,
.startedDateTime,
.request.method,
.request.url,
.request.httpVersion,
.request.headersSize,
.request.bodySize,
.response.status,
.response.content.size,
.response.content.compression,
.response._transferSize,
(.response.headers[] | select(.name | match("content-type";"i")).value),
(.response.headers[] | select(.name | match("content-length";"i")).value),
(.response.headers[] | select(.name | match("cache-control";"i")).value),
.time,
.timings.blocked,
.timings.dns,
.timings.connect,
.timings.ssl,
.timings.send,
.timings.wait,
.timings.receive,
.timings["_blocked_queueing"]
]
)
# output in CSV format
| @csv