You are on page 1of 1

function(context, args) { //t:"username", n:"start from index 1000 * n"

let t = args.t
let from_i = args.n * 1000
let al_to = from_i + 1000
let trans_to = from_i + 1000

if (!t || (!from_i && from_i !== 0) || !al_to)


return {ok: false, msg: "Check the paramters and try again."}

let access_log = #s.sys.expose_access_log({target: t})


let transactions = #s.sys.expose_transactions({target: t})

if (access_log.length < al_to)


al_to = access_log.length

if (transactions.length < trans_to)


trans_to = transactions.length

access_log = access_log.slice(from_i, al_to)


transactions = transactions.slice(from_i, trans_to)

#db.i(
{
target: t,
type: "breach_logs",
transactions: transactions,
access_log: access_log
}
)

return `Grabbed ${access_log.length} entries from access_log and $


{transactions.length} entries from transaction history.`
}

You might also like