forked from Nooshu/har2csv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhar2tsv.jq
executable file
·58 lines (56 loc) · 1.3 KB
/
har2tsv.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
#!/usr/bin/env jq -rMf
# Quickly convert a HTTP Archive file (har) to a TSV file.
# Headers for resulting CSV file
[
"pageRef",
"startedDateTime",
"requestMethod",
"requestUrl",
"requestHttpVersion",
"requestHeaderSize",
"requestBodySize",
"responseStatus",
"responseContentSize",
"responseContentType",
"responseContentLength",
"responseCacheControl",
"time",
"blocked",
"dns",
"connect",
"ssl",
"send",
"wait",
"receive"
],
(
# 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 TSV
| [
.pageref,
.startedDateTime,
.request.method,
.request.url,
.request.httpVersion,
.request.headersSize,
.request.bodySize,
.response.status,
.response.content.size,
(.response.headers[] | select(.name == "content-type").value),
(.response.headers[] | select(.name == "content-length").value),
(.response.headers[] | select(.name == "cache-control").value),
.time,
.timings.blocked,
.timings.dns,
.timings.connect,
.timings.ssl,
.timings.send,
.timings.wait,
.timings.receive
]
)
# output in TSV format
| @tsv