Select programming language for code examples

linkEvent logsBetaEnt

Event logs are automatically populated as events are made on your Keygen account. Event logs can be used for auditing and debugging purposes.

Event logs are available for Keygen Cloud customers on an Ent tier, as well as for all Keygen EE customers. Event logs are not available in Keygen CE, or for Keygen Cloud customers on a Std tier. If you're running Keygen CE and would like to try event logs, reach out for a 30-day no-strings-attached trial of Keygen EE.

This feature is currently in beta. Please reach out to gain access to the beta program, or to report any feedback or issues. All functionality is subject to change until the beta designation is removed from the feature.

linkThe event log object

Below you will find the various attributes for the event log resource.

By default, most event logs are kept into perpetuity. Certain high-volume events, e.g. license validation, may be pruned every 90 days.

linkAttributes

  • linkdata.attributes.event

    stringread only

    The event type.

  • linkdata.attributes.metadata

    object<string, any>read only

    Object containing event metadata.

    Depending on the event type, this may include a license validation code, a diff of the resource's updated attributes (new, old), what version an upgrade was from, etc. All metadata is subject to change.
  • linkdata.attributes.created

    timestamp (iso8601)read only

    When the event was triggered.

  • linkdata.attributes.updated

    timestamp (iso8601)read only

    When the event log was last updated.

linkRelationships

  • linkdata.relationships.account

    individual

    The account that the event was for.

  • linkdata.relationships.environment

    individualent onlyThese relationships are only available for accounts on an Ent tier.

    The environment that the event was for.

  • linkdata.relationships.request

    individual

    The request that triggered the event.

  • linkdata.relationships.whodunnit

    individual

    Who triggered the event.

  • linkdata.relationships.resource

    individual

    The resource the event was for.

Example object

{
"data": {
"id": "ce7d8015-7216-4274-9b08-c201f8c5eda4",
"type": "event-logs",
"attributes": {
"event": "license.updated",
"metadata": {
"diff": {
"expiry": [
"2023-09-26T16:08:27.575Z",
"2016-09-05T22:53:37.000Z"
]
}
},
"created": "2023-09-12T16:08:27.999Z",
"updated": "2023-09-12T16:08:27.999Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"environment": {
"links": {
"related": null
},
"data": null
},
"request": {
"links": {
"related": "/v1/accounts/<account>/request-logs/481b2319-9441-46d4-9ce3-c1960510101c"
},
"data": {
"type": "request-logs",
"id": "481b2319-9441-46d4-9ce3-c1960510101c"
}
},
"whodunnit": {
"links": {
"related": "/v1/accounts/<account>/users/ed812000-42cb-4495-9038-749b08f4a09a"
},
"data": {
"type": "users",
"id": "ed812000-42cb-4495-9038-749b08f4a09a"
}
},
"resource": {
"links": {
"related": "/v1/accounts/<account>/licenses/4110c2a6-7d66-4573-8147-d641d352601a"
},
"data": {
"type": "licenses",
"id": "4110c2a6-7d66-4573-8147-d641d352601a"
}
}
},
"links": {
"self": "/v1/accounts/<account>/event-logs/ce7d8015-7216-4274-9b08-c201f8c5eda4"
}
}
}

linkRetrieve an event log

Retrieves the details of an existing event log.

linkAuthentication

  • linkBearer

    optional

    An authentication token with privileges to read the event log: an admin or an environment.

linkURL Parameters

  • link<account>

    stringrequired

    The identifier (UUID) or slug of your Keygen account.

  • link<event>

    stringrequired

    The identifier (UUID) of the event log to be retrieved.

linkReturns

A 200 OK response will be returned along with an event log object.

Upon error, an errors object will be returned along with an HTTP status code indicating the type of error. When an error occurs, the data property will not be included.

Definition

https://api.keygen.sh/v1/accounts/<account>/event-logs/<event>

Example event

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/<account>/event-logs", {
method: "GET",
headers: {
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
}
})
 
const { data, errors } = await response.json()
import events
import json
 
res = events.get(
"https://api.keygen.sh/v1/accounts/<account>/event-logs",
headers={
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
}
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.event("https://api.keygen.sh/v1/accounts/<account>/event-logs",
headers: [
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
]
).responseJSON { response in
let json = JSON(data: response.data!)
}
using RestSharp;
 
var client = new RestClient("https://api.keygen.sh/v1/accounts/<account>");
var event = new RestRequest(
"event-logs",
Method.GET
);
 
event.AddHeader("Authorization", "Bearer <token>");
event.AddHeader("Accept", "application/vnd.api+json");
 
var response = client.Execute(event);
import com.mashape.unirest.http.exceptions.*
import com.mashape.unirest.http.*
 
val res = Unirest.get("https://api.keygen.sh/v1/accounts/<account>/event-logs")
.header("Authorization", "Bearer <token>")
.header("Accept", "application/vnd.api+json")
.asJson()
import com.mashape.unirest.http.exceptions.*;
import com.mashape.unirest.http.*;
 
HttpResponse<JsonNode> res = Unirest.get("https://api.keygen.sh/v1/accounts/<account>/event-logs")
.header("Authorization", "Bearer <token>")
.header("Accept", "application/vnd.api+json")
.asJson();
#include <iostream>
#include <string>
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
 
using namespace std;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace utility;
 
http_client client("https://api.keygen.sh/v1/accounts/<account>");
http_event req;
 
req.headers().add("Authorization", "Bearer <token>");
req.headers().add("Accept", "application/json");
 
req.set_event_uri("/event-logs");
req.set_method(methods::GET);
 
client.event(req)
.then([](http_response res) {
auto data = res.extract_json().get();
})
.wait();
curl https://api.keygen.sh/v1/accounts/<account>/event-logs \
-H 'Authorization: Bearer <token>' \
-H 'Accept: application/vnd.api+json'

Example response / 200 OK

{
"data": {
"id": "ce7d8015-7216-4274-9b08-c201f8c5eda4",
"type": "event-logs",
"attributes": {
"event": "license.validation.failed",
"metadata": {
"code": "EXPIRED"
},
"created": "2023-09-12T16:08:27.999Z",
"updated": "2023-09-12T16:08:27.999Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"environment": {
"links": {
"related": null
},
"data": null
},
"request": {
"links": {
"related": "/v1/accounts/<account>/request-logs/481b2319-9441-46d4-9ce3-c1960510101c"
},
"data": {
"type": "request-logs",
"id": "481b2319-9441-46d4-9ce3-c1960510101c"
}
},
"whodunnit": {
"links": {
"related": "/v1/accounts/<account>/licenses/4110c2a6-7d66-4573-8147-d641d352601a"
},
"data": {
"type": "licenses",
"id": "4110c2a6-7d66-4573-8147-d641d352601a"
}
},
"resource": {
"links": {
"related": "/v1/accounts/<account>/licenses/4110c2a6-7d66-4573-8147-d641d352601a"
},
"data": {
"type": "licenses",
"id": "4110c2a6-7d66-4573-8147-d641d352601a"
}
}
},
"links": {
"self": "/v1/accounts/<account>/event-logs/ce7d8015-7216-4274-9b08-c201f8c5eda4"
}
}
}

linkList all event logs

Returns a list of event logs. The event logs are returned sorted by creation date, with the most recent event logs appearing first.

linkAuthentication

  • linkBearer

    optional

    An authentication token with privileges to read the event logs: an admin or an environment.

linkURL Parameters

  • link<account>

    stringrequired

    The identifier (UUID) or slug of your Keygen account.

linkQuery Parameters

  • linkdate

    object<string, integer>

    Object containing start and end dates. Must be ISO8601 format.

    /v1/accounts/<account>/event-logs?date[start]=2023-09-12T00:00:00.002Z&date[end]=2023-09-12T23:59:59.992Z
  • linklimit

    integerdefault=10

    A limit on the number of event logs to be returned. Limit must be a number between 1 and 100.

    /v1/accounts/<account>/event-logs?limit=25
  • linkpage

    object<string, integer>

    Object containing page size and page number. Page size must be a number between 1 and 100.

    /v1/accounts/<account>/event-logs?page[size]=15&page[number]=2
  • linkresource

    object<type, id>

    Object containing resource type and id.

    /v1/accounts/<account>/event-logs?resource[type]=license&resource[id]=bca8cd83-91f5-4718-ab0d-70bf3c87a513

linkReturns

A 200 OK response will be returned along with a list of event log objects.

Upon error, an errors object will be returned along with an HTTP status code indicating the type of error. When an error occurs, the data property will not be included.

Definition

https://api.keygen.sh/v1/accounts/<account>/event-logs

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/<account>/event-logs?limit=15", {
method: "GET",
headers: {
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
}
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.get(
"https://api.keygen.sh/v1/accounts/<account>/event-logs?limit=15",
headers={
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
}
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/<account>/event-logs?limit=15",
headers: [
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
]
).responseJSON { response in
let json = JSON(data: response.data!)
}
using RestSharp;
 
var client = new RestClient("https://api.keygen.sh/v1/accounts/<account>");
var request = new RestRequest("event-logs", Method.GET);
 
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Accept", "application/vnd.api+json");
 
request.AddParameter("limit", 15);
 
var response = client.Execute(request);
import com.mashape.unirest.http.exceptions.*
import com.mashape.unirest.http.*
 
val res = Unirest.get("https://api.keygen.sh/v1/accounts/<account>/event-logs")
.header("Authorization", "Bearer <token>")
.header("Accept", "application/vnd.api+json")
.queryString("limit", 15)
.asJson()
import com.mashape.unirest.http.exceptions.*;
import com.mashape.unirest.http.*;
 
HttpResponse<JsonNode> res = Unirest.get("https://api.keygen.sh/v1/accounts/<account>/event-logs")
.header("Authorization", "Bearer <token>")
.header("Accept", "application/vnd.api+json")
.queryString("limit", 15)
.asJson();
#include <iostream>
#include <string>
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
 
using namespace std;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace utility;
 
http_client client("https://api.keygen.sh/v1/accounts/<account>");
http_request req;
 
req.headers().add("Authorization", "Bearer <token>");
req.headers().add("Accept", "application/json");
 
uri_builder uri("/event-logs");
uri.append_query("limit", 15);
 
req.set_request_uri(uri.to_uri());
req.set_method(methods::GET);
 
client.request(req)
.then([](http_response res) {
auto data = res.extract_json().get();
})
.wait();
curl https://api.keygen.sh/v1/accounts/<account>/event-logs?limit=15 -g \
-H 'Authorization: Bearer <token>' \
-H 'Accept: application/vnd.api+json'

Example response / 200 OK

{
"data": [
{
"id": "ce7d8015-7216-4274-9b08-c201f8c5eda4",
"type": "event-logs",
"attributes": {
"event": "license.validation.failed",
"metadata": {
"code": "EXPIRED"
},
"created": "2023-09-12T16:08:27.999Z",
"updated": "2023-09-12T16:08:27.999Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"environment": {
"links": {
"related": null
},
"data": null
},
"request": {
"links": {
"related": "/v1/accounts/<account>/request-logs/481b2319-9441-46d4-9ce3-c1960510101c"
},
"data": {
"type": "request-logs",
"id": "481b2319-9441-46d4-9ce3-c1960510101c"
}
},
"whodunnit": {
"links": {
"related": "/v1/accounts/<account>/licenses/4110c2a6-7d66-4573-8147-d641d352601a"
},
"data": {
"type": "licenses",
"id": "4110c2a6-7d66-4573-8147-d641d352601a"
}
},
"resource": {
"links": {
"related": "/v1/accounts/<account>/licenses/4110c2a6-7d66-4573-8147-d641d352601a"
},
"data": {
"type": "licenses",
"id": "4110c2a6-7d66-4573-8147-d641d352601a"
}
}
},
"links": {
"self": "/v1/accounts/<account>/event-logs/ce7d8015-7216-4274-9b08-c201f8c5eda4"
}
},
...
]
}