Read HTTP Archive ('HAR') Data

The goal of 'HARtools' is to provide a simple set of functions to read/parse, write and visualise HTTP Archive ('HAR') files in R.


CRAN versionTravis build statusCoverage

HARtools provdes tools and utilities to interact with HTTP Archive (HAR) files in R.

To install the current developement version of HARtools run:

devtools::install_github("johndharrison/HARtools")
library(HARtools)
exampleHAR <- 
  system.file(package = "HARtools", "exdata", "inline-scripts-block.har")
har <- readHAR(exampleHAR)
--------HAR VERSION-------- 
  HAR specification version: 1.1 
--------HAR CREATOR-------- 
  Created by: Firebug 
version: 1.5X.0b8 
--------HAR BROWSER-------- 
  Browser: Firefox 
version: 3.6b6pre 
--------HAR PAGES-------- 
  Page id: page_21396 , Page title: Cuzillion 
Page id: page_20633 , Page title: Cuzillion 
--------HAR ENTRIES-------- 
  Number of entries: 8 
REQUESTS: 
  Page: page_20633 
Number of entries: 4 
-  http://stevesouders.com/cuzillion/?c0=bi1hfff1_0_f&c1=bi1hfff1_0_f&c2=bb0... 
-  http://stevesouders.com/cuzillion/logo-32x32.gif 
-  http://1.cuzillion.com/bin/resource.cgi?type=gif&sleep=1&n=1&t=1262445158 
-  http://1.cuzillion.com/bin/resource.cgi?type=gif&sleep=1&n=2&t=1262445158 
Page: page_21396 
Number of entries: 4 
-  http://stevesouders.com/cuzillion/?ex=10100&title=Inline+Scripts+Block 
-  http://stevesouders.com/cuzillion/logo-32x32.gif 
-  http://1.cuzillion.com/bin/resource.cgi?type=gif&sleep=1&n=1&t=1262443132 
-  http://1.cuzillion.com/bin/resource.cgi?type=gif&sleep=1&n=3&t=1262443132   
urlHAR <- "http://www.janodvarko.cz/har/viewer/examples/google.com.har"
har <- readHAR(urlHAR)
> har
--------HAR VERSION-------- 
  HAR specification version: 1.1 
--------HAR CREATOR-------- 
  Created by: Firebug 
version: 1.5X.0b8 
--------HAR BROWSER-------- 
  Browser: Firefox 
version: 3.6b6pre 
--------HAR PAGES-------- 
  Page id: page_62143 , Page title: Google 
--------HAR ENTRIES-------- 
  Number of entries: 5 
REQUESTS: 
  Page: page_62143 
Number of entries: 5 
-  http://www.google.cz/ 
-  http://www.google.cz/intl/en_com/images/logo_plain.png 
-  http://www.google.cz/extern_js/f/CgJjcxICY3orMAo4QUAdLCswDjgKLCswFjgULCsw... 
-  http://clients1.google.cz/generate_204 
-  http://www.google.cz/images/nav_logo7.png 

HARtools includes a HARviewer function which utilises the PerfCascade JavaScript library to produce an interactive waterfall chart of the HAR data:

har <- readHAR(system.file(package = "HARtools", "exdata",
                           "r-project.org.161028_W2_11MA.har"))
hv <- HARviewer(har)
# view in R
hv
 
# save and view
tFile <- tempfile(fileext = ".html")
htmlwidgets::saveWidget(hv,file = tFile)
browseURL(tFile)
 

The resulting output of HARviewer can be interacted with here.

library(shiny)
if(interactive()){
  library(HARtools)
  har <- readHAR(system.file(package = "HARtools", "exdata",
                             "r-project.org.161028_W2_11MA.har"))
  hv <- HARviewer(har)
  
  app <- shinyApp(
    ui = fluidPage(
      HARviewerOutput("myHAR")
    ),
    server = function(input, output) {
      output$myHAR <- renderHARviewer(hv)
    }
  )  
  runApp(app)
}

News

0.0.5

  • Add support for Windows UTF-8 read and write

0.0.4

  • Add basic use vignette

0.0.3

  • Add select bar to HARviewer chart to select between pages in HAR
  • Add shiny bindings for HARviewer chart

0.0.2

  • Add htmlwidget dependency. Add PerfCascade library to create waterfall charts
  • Add basic HARviewer chart

0.0.1

  • Initial commit

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("HARtools")

0.0.5 by John Harrison, 8 months ago


https://johndharrison.github.io/HARtools/index.html


Report a bug at https://github.com/johndharrison/HARtools/issues


Browse source code at https://github.com/cran/HARtools


Authors: John Harrison [aut, cre] (R package HARtools), Michael Mrowetz [aut, cph] (PerfCascade library, https://micmro.github.io/PerfCascade/)


Documentation:   PDF Manual  


GPL-3 license


Imports assertthat, magrittr, jsonlite, htmlwidgets, htmltools

Suggests testthat, covr, httr, shiny, knitr, rmarkdown


See at CRAN