import { Avalanche } from "@avalanche-sdk/chainkit";
const avalanche = new Avalanche();
async function run() {
const result = await avalanche.data.usageMetrics.getLogs({
startTimestamp: 1739507200,
endTimestamp: 1739664000,
});
for await (const page of result) {
console.log(page);
}
}
run();{
"orgId": "<string>",
"logs": [
{
"orgId": "<string>",
"logId": "<string>",
"eventTimestamp": 123,
"apiKeyId": "<string>",
"apiKeyAlias": "<string>",
"hostRegion": "<string>",
"requestType": "data",
"requestPath": "<string>",
"apiCreditsConsumed": 123,
"requestDurationMsecs": 123,
"responseCode": 123,
"metadata": {
"ipAddress": "<string>",
"host": "<string>",
"userAgent": "<string>"
},
"chainId": "<string>",
"rpcMethod": "<string>"
}
],
"nextPageToken": "<string>"
}Gets logs for requests made by client over a specified time interval for a specific organization.
import { Avalanche } from "@avalanche-sdk/chainkit";
const avalanche = new Avalanche();
async function run() {
const result = await avalanche.data.usageMetrics.getLogs({
startTimestamp: 1739507200,
endTimestamp: 1739664000,
});
for await (const page of result) {
console.log(page);
}
}
run();{
"orgId": "<string>",
"logs": [
{
"orgId": "<string>",
"logId": "<string>",
"eventTimestamp": 123,
"apiKeyId": "<string>",
"apiKeyAlias": "<string>",
"hostRegion": "<string>",
"requestType": "data",
"requestPath": "<string>",
"apiCreditsConsumed": 123,
"requestDurationMsecs": 123,
"responseCode": 123,
"metadata": {
"ipAddress": "<string>",
"host": "<string>",
"userAgent": "<string>"
},
"chainId": "<string>",
"rpcMethod": "<string>"
}
],
"nextPageToken": "<string>"
}Api keys provide higher access to rate limits. To obtain an api key, sign up for an account at https://avacloud.io/.
Organization ID to fetch usage metrics for
The start time of the range as a UNIX timestamp. The requested start time will be rounded down to 0:00 UTC of the day.
x >= 0The end time of the range as a UNIX timestamp. The requested end time will be rounded down to 0:00 UTC of the day.
x >= 0Filter data by chain ID.
Filter data by response status code.
Filter data by request type.
data, rpc Filter data by API key ID.
Filter data by request path.
A page token, received from a previous list call. Provide this to retrieve the subsequent page.
The maximum number of items to return.
1 <= x <= 100Successful response
The organization id of the request.
An array of logs representing the requests made by clients.
Show child attributes
A token, which can be sent as pageToken to retrieve the next page. If this field is omitted or empty, there are no subsequent pages.
Was this page helpful?