The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Audit logging data

KoboToolbox audit logging feature records all activities related to a specific form submission in a log file. This log file can include things like when the form was opened, when individual questions were answered, when the form was saved, and when it was finally submitted. This feature provides a detailed record of the timing and sequence of events associated with each form submission.

This feature can be especially beneficial for several reasons:

Audit logging data

The form below provides a toy example to showcase how audit logs can be read using robotoolbox.

type name label parameters
start start
end end
username username
audit audit identify-user=true location-priority=balanced location-min-interval=60 location-max-age=120 track-changes=true track-changes-reasons=on-form-edit
text Q1 Q1. What is your name?
integer Q2 Q2. How old are you?

We have four metadata questions: start, end, username and audit. You need to have the audit metadata question enable to use this feature. We also have two questions: Q1 and Q2.

Loading the project

The above form was uploaded to the server. It’s the only project named Audit multi params, and can be selected from the list of assets asset_list.

library(robotoolbox)
library(dplyr)
asset_list <- kobo_asset_list()
uid <- filter(asset_list, name == "Audit multi params") |>
  pull(uid)
asset <- kobo_asset(uid)
asset
#> <robotoolbox asset>  aKQB8xLBd3nsJ7EZQmQhZd 
#>   Asset name: Audit multi params
#>   Asset type: survey
#>   Asset owner: dickoa
#>   Created: 2023-05-14 17:47:38
#>   Last modified: 2023-05-14 17:48:10
#>   Submissions: 3

Extracting the audit data

In order to get the audit logging, we need to use the kobo_audit function.

df <- kobo_audit(asset)
glimpse(df)
#> Rows: 29
#> Columns: 13
#> $ `_id`           <int> 28971013, 28971013, 28971013, 28971013, 28971013, 2897…
#> $ event           <chr> "form start", "location tracking enabled", "location p…
#> $ node            <chr> "", "", "", "", "/aKQB8xLBd3nsJ7EZQmQhZd/Q1", "/aKQB8x…
#> $ name            <chr> "", "", "", "", "Q1", "Q2", "", "", "", "", "", "", "Q…
#> $ start           <dttm> 2023-05-14 18:01:40, 2023-05-14 18:01:40, 2023-05-14 …
#> $ end             <dttm> NA, NA, NA, NA, 2023-05-14 18:02:16, 2023-05-14 18:02…
#> $ latitude        <dbl> NA, NA, NA, NA, 14.72042, 14.72042, 14.72042, 14.72042…
#> $ longitude       <dbl> NA, NA, NA, NA, -17.46704, -17.46704, -17.46704, -17.4…
#> $ accuracy        <dbl> NA, NA, NA, NA, 20, 20, 20, 20, 20, 20, NA, NA, 20, NA…
#> $ `old-value`     <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ `new-value`     <chr> "", "", "", "", "Yasmine", "35", "", "", "", "", "", "…
#> $ user            <chr> "Aicha", "Aicha", "Aicha", "Aicha", "Aicha", "Aicha", …
#> $ `change-reason` <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…

The columns in the audit logging data include:

The structure of the output depends on the parameters of the audit logging you set in your form. For instance, if you set the parameter track-changes=true, the columns old-value and new-value become available. latitude, longitude and accuracy are associated to the parameter location-priority. The user column is available when you use the identify-user=true parameter. Using the parameter track-changes-reasons=on-form-edit prevent you to edit a filled out forms without giving a reason. These reasons are recored in the column change-reason. You can learn how to use audit logging in the documentation of KoboToolbox and ODK.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.