REST API to send log data, export data and manage configuration
To utilize the inline testing functionality here, please go into your Mezmo account and add the following
address to your CORS Origins page: https://docs.mezmo.com
.
This key is used for all apis with the exception o ingest. You can obtain it following these instructions and placing the key in the header of your call.
Key | In | |
---|---|---|
servicekey | Header |
This key is used for ingestion. You can obtain it following these instructions and placing the key in the header of your call.
Key | In | |
---|---|---|
apikey | Header |
As an alternative to authenticating with a header value, you can also use basic authentication.
To use either apiKey
or servicekey
as basic authentication, simply pass the key
as the username with no password. For example:
curl https://api.logdna.com/v1/config/view -u INSERT_INGESTION_KEY:
Archiving
Authentication: You can find instructions on authentication here.
The LogDNA Archiving API enables you to programmatically configure your archiving instances via code. Specifically you can set up cold storage buckets to send your logs for long term storage.
Get Archive Configuration
Use this method to get an existing archiving configuration.
OK
Archiving configuration not found
Create Archive Configuration
Use this method to configure archiving for an instance. Only one archiving configuration may exist at any time.
Request parameters
OK
Bad request
An archiving configuration already exists. Cannot create a new one
Update Archive Configuration
Use this method to update an existing archiving configuration.
Request parameters
OK
Bad request
Existing archiving integration not found
Delete Archive Configuration
Use this method to delete the archiving configuration.
OK
Archiving configuration not found
Configuration
Authentication: You can find instructions on authentication here.
The LogDNA API's Configuration endpoints are used to create, update, and delete views, alerts, and categories.
List Views
Get a list of views.
OK
Bad request
Create View
Use this method to create a view and attach alerts to the view.
Request parameters
OK
Bad request
Get View
Gets the configuration for a specific view.
OK
Bad request
Update View
Use this method to update a view. You can change the view configuration details; add or remove view specific alerts; or attach and detach preset alerts.
Request parameters
OK
Bad request
Delete View
Use this method to delete a view and any attached alerts.
OK
Bad request
List Preset Alerts
Returns all Preset Alerts in the account.
OK
Bad request
Create Preset Alert
Use this method to create a preset alert.
Request parameters
OK
Bad request
Get Preset Alert
Get a specific preset alert
OK
Bad request
Update Alert
Update a specific preset alert.
Request parameters
OK
Bad request
Delete Alert
Use this method to delete a preset alert.
OK
Bad request
List Categories
Returns all Categories of a type.
OK
Bad request
Create New Category
Creates a new category of this type.
Request parameters
OK
Bad request
Get Category
Get a specific category
OK
Bad request
Update Category
Update a specific category.
Request parameters
OK
Bad request
Delete Category
Use this method to delete a category.
OK
Bad request
Export
LogDNA provides two endpoints for exporting your log lines. Read the sections below to learn about each, and determine which is appropriate for your use case.
Export API v1
The Export API v1 is used to export log lines in JSONL format. Based on your specific plan, the maximum number of logs returned is limited to 10,000 / 20,000. There are two distinct functionalities:
- Streaming desired log lines directly from the response as raw text data
- Specifying an email to receive a link that can be used to the download the desired log lines
Note When an email address is specified, the desired log lines will not be streamed to the response body. The response will instead send a notification indicating that the request was successful and that the results will be sent to the email address provided in the request. This entails archiving and uploading the desired logs to a storage provider. The email includes a URI to download the logs. Be aware that access to this URI will expire after 24-48 hours.
Export API v2
The Export API v2 provides an enhancement over v1, allowing you to export any number of log lines using pagination and
by-passing the plan-specific limit imposed in v1. By making (multiple) subsequent requests using the pagination_id
parameter,
you can retrieve logs in batches of JSON until all matching log lines have been returned.
Each Export API v2 request is limited to 10,000 lines.
Pagination Functionality
Pagination is only necessary when the desired set of log lines is larger than 10,000, since this is the maximum number of results that can be returned in a given page. If an export does not exceed this size, the behavior is similar to v1 -- all of the logs will be returned in a single "page" and no further requests are needed. When an export does exceed this size, refer to the steps outlined below.
This is the expected workflow to export a set (cardinality > 10,000) of log lines that requires pagination:
- Send an initial request with valid query parameters to retrieve logs. Pass a
null
value for thepagination_id
in the first request. - The JSON response contains 2 fields:
lines
andpagination_id
. The former is an array containing the corresponding batch (the first batch in this case) of logs and the latter is a token used to retrieve the next page of results. - Send a subsequent request using the same initial query parameters and also passing in the token received in the response to the
pagination_id
parameter. This will retrieve the next page of results. - Repeat this request-response cycle, updating the
pagination_id
parameter with the token returned in every new response, until the response eventually returns anull
value for the token. This indicates that the corresponding batch of logs is the last and that you have reached the final page.
Important Considerations In subsequent requests to paginate through results, make sure none of the query parameters & values are modified from the initial request (excluding
pagination_id
)
The tokens used in the
pagination_id
parameter are tied to a specific export and page so they can be used repeatedly in requests to return deterministic results
"0" can be passed in to the
from
andto
parameters which will be resolved to timestamps for a plan's retention boundary and the current time respectively. This behavior is independent so the value can be passed interchangeably to the parameters -- resulting in 4 possible scenarios:
- [
from
: <user-specified timestamp>,to
: <user-specified timestamp>]- [
from
: 0 (retention boundary),to
: <user-specified timestamp>]- [
from
: <user-specified timestamp>,to
: 0 (current time)]- [
from
: 0 (retention boundary),to
: 0 (current time)]
Export log lines
Use this method to export logs in JSON format from a logging instance.
OK
Bad request
Export log lines
Use this method to export logs in JSON format from a logging instance.
OK
Bad request
Ingestion
Ingestion API
Send Log Lines
Use this method to send logs to a logging instance.
Authentication
You can find instructions on authentication here. Ingestion is
similar to the other APIs, but instead of servicekey
you will use apikey
if
you are using the header style authentication.
Metadata
Meta is a field reserved for custom information associated with a log line. To add
metadata to an API call, specify the meta
field under the lines object. Metadata can be
viewed inside that line's context
WARNING: If inconsistent value types are
used, that line's metadata, will not be parsed. For example, if a line is passed
with a meta object, such as meta.myfield
of type String, any subsequent lines
with meta.myfield
must have a String as the value type for meta.myfield
.
Please be aware of service limits on this endpoint
You can send multiple log lines in a request.
OK
Unauthorized
Forbidden
Not Found
Exclusions
Authentication: You can find instructions on authentication here.
Control what you store by creating exclusion rules. New lines that match an exclusion rule will not be stored and will not count toward your storage quota.
List Exclusion Rules
Returns a list of exclusion rules. Note: This does not return usage quota rules.
OK
Internal Server error occured when trying to fetch exclusion rules
Create Exclusion Rule
Create a new ingestion exclusion rule to help reduce log volume
Request parameters
OK
Bad request. Query inside of exclusion rule failed to parse.
An internal error occured when trying to create exclusion rule.
Get Exclusion Rule
Returns an exclusion rule with the id specified.
OK
Malformed ingestion exclusion rule response payload. The exclusion rule may be stored incorrectly
Exclusion rule not found
Internal Server Error. Failed to get exclusion rule
Update Exclusion Rule
Updates an existing exclusion rule
Request parameters
OK
Bad request. The rule is invalid. Double check rule and query syntax and try again.
Internal server error. The rule could not be updated at this time.
Delete Exclusion Rule
Use this method to delete an exclusion rule.
OK
Exclusion rule not found
Internal Server Error. Failed to delete exclusion rule.
Suspensions
Authentication: You can find instructions on authentication here.
The LogDNA Start/Stop Ingestion API allows users to programmatically manage their data ingestion status.
Users can get the current status of their ingestion, suspend their ingestion, and resume their ingestion. To prevent an accidental API call, the suspension of ingestion requires two subsequent API calls.
You can find instructions on authentication here.
Get Ingestion Status
Retrieve the status of ingestion
OK
Failed to fetch ingestion status
Initiate Ingestion Suspension
First step in suspending ingestion for the instance. Returns a token for use in /suspend/confirm to actually stop ingestion
Token to be used in /suspend/confirm
Confirm Ingestion Suspension
After /suspend is called, a token is returned for use with this route as a confirmation.
Request parameters
OK
Bad Suspend Token
Failed to fetch ingestion status
Resume Ingestion
Resumes ingestion if it has been previously suspended
OK
Failed to fetch ingestion status
Usage V1
Authentication: You can find instructions on authentication here.
The Usage API provides endpoints for retrieving aggregated usage information for applications, hosts and tags during a time period.
While the to
and from
times are unix timestamps, the report is granular by day. Therefore only the day portion is used to establish a date range.
How is Usage defined?
This API defines usage as a percentage of the total number of lines ingested by the account within the defined period of time. For
example, an app called myapp
that returns a percentage of 15
in the response object has 15 percent of their logs coming from myapp
.
List Usage By App
Lists aggregated usage information for all apps during a time period.
OK
Bad request
Get Usage By App
Gets the aggregated usage information for an app matching the name provided as a path parameter, during a time period. Returns null when not found.
OK
Bad request
List Usage by Tag
Lists aggregated usage information for all tags during a time period.
OK
Bad request
Get Usage by Tag
Gets the aggregated usage information for a tag matching the name provided as a path parameter, during a time period. Returns null when not found.
OK
Bad request
List Usage by Host
Lists aggregated usage information for all hosts during a time period.
OK
Bad request
Get Usage by Host
Gets the aggregated usage information for a host matching the name provided as a path parameter, during a time period. Returns null when not found.
OK
Bad request
Usage V2
Authentication: You can find instructions on authentication here.
The Usage API provides endpoints for retrieving aggregated usage information for applications, hosts and tags during a time period.
While the to
and from
times are unix timestamps, the report is granular by day. Therefore only the day portion is used to establish a date range.
How is Usage defined?
This API defines usage as the number of bytes used by the log lines stored
on disk by the account within the defined period of time. For example,
an app called myapp
that returns 150,000
total bytes in the response
object indicates that myapp
is consuming 150,000
bytes of disk storage
over the time range.
Retrieve account usage totals
Get aggregated usage information for an account's data during a time period.
OK
Bad request
List Usage By App
Lists aggregated usage information for all apps during a time period.
OK
Bad request
Get Usage By App
Gets the aggregated usage information for an app matching the name provided as a path parameter during a time period. The results
will either have a singular item, or be an empty array.
OK
Bad request
List Usage by Host
Lists aggregated usage information for all hosts during a time period.
OK
Bad request
Get Usage by Host
Gets the aggregated usage information for a host matching the name provided as a path parameter during a time period. The results
will either have a singular item, or be an empty array.
OK
Bad request
List Usage by Tag
Lists aggregated usage information for all tags during a time period.
OK
Bad request
Get Usage by Tag
Gets the aggregated usage information for a tag matching the name provided as a path parameter during a time period. The results
will either have a singular item, or be an empty array.
OK
Bad request
List Groups
Use this method to list the log groups.
OK
Bad request
Create Group
Use this method to create a log group where you can scope the data that is accessible by members in that group.
Request parameters
OK
Bad request
Get Group
Use this method to get information on a group.
OK
Bad request
Delete Group
Use this method to list the log groups.
OK
Bad request
Update Group
Use this method to modify a log group. You can change the name of the group and the access scope that defines the data that is accessible by members in that group.
Request parameters
OK
Bad request
Retrieve a list of all the keys
Retrieve a list of all the keys for an account. Supported key types include ingestion
and service
. Use the type
parameter to filter which type of keys to retrieve.
A list of keys is returned on success.
The supplied request is invalid or malformed.
Create a new key
Create a new key of the type specified by the type
parameter. If a name is not supplied, one will be auto generated.
Modifiable fields can be set in the request body.
A new key was created successfully! The entire key resource is returned.
The supplied request is invalid or malformed.
Retrieve a specific key
Retrieves a specific key by its id
.
The key with the supplied id
was found, the entire resource is returned.
The specified key was not found.
Delete a specific key
Delete a specific key by its id
.
The key was deleted successfully, a simple status is returned.
The specified key was not found.
Update one or more fields of a key resource
Updates all of the fields described in the request body of the specified key. Fields left out of the body will remain unaffected.
The update was successful; the key resource is returned with updated fields.
The supplied request is invalid or malformed.
The specified key was not found.
Index Rate Alert
Get Index Rate Alert
Gets the configuration for an Index Rate Alert
OK
Bad request
Internal Server error occurred when trying to fetch index rate alerts
Update Index Rate Alert
Use this method to update an index rate alert. You can change the alert's configuration details.
Request parameters
OK
Bad request
Internal Server error occurred when trying to fetch index rate alerts
Lists all members
Retrieves all of the current members in an organization and returns their email, role, and groups.
A list of members is returned on success.
Creates a new member
Create a new user and add to the team by providing 'email', 'role' and an optional list of RBAC groups.
Request parameters.
A new member was created successfully! Entire memberResource is returned.
The supplied request is invalid or malformed.
The supplied request leads to an invalid state. The returned error will contain more helpful information.
Retrieve a member
Returns the role and groups of the specified member.
The member with the supplied email
was found, the entire resource is returned.
The specified member was not found.
Delete a member
Removes a member from the organization. This does not delete the user.
The member was removed successfully, a simple status is returned.
The specified member was not found.
The specified member (owner) cannot be removed
Update a member
Updates all the fields described in the request body of the specified member. Creates a member if the member doesn't exist already. Fields left out of the body will remain unaffected.
The update was successful; the member resource is returned with updated fields.
The supplied request is invalid or malformed.
The supplied request leads to an invalid state. The returned error will contain more helpful information.
List all accounts
Retrieves a list of all child organizations that belong to the enterprise.
A list of child organizations is returned on success.
A poorly formatted request returns with a BadRequest
code.
Attach a child organization to an enterprise
Attaches an existing organization to an enterprise. The retention
and owner
field are optional, and will be defaulted if not specified.
Request parameters.
Child organization successfully attached.
A poorly formatted request returns with a BadRequest
code.
The supplied request leads to an invalid state. The returned error will contain more helpful information.
Get details of a child organization
Retrieves a specific child organization by its id. If the organization does not belong to the enterprise, a 404 error is returned.
The child organization was found and returned.
Update Child Organization Contract
Makes an update to the specified child organization. Used to modify the current retention with the retention
field or the current owner with the owner
field.
The account was found, the enterpriseId and retention details are updated.
Invalid body
Unable to update account which not belong to enterprise
Return error when account does not have contract tier
Detach a child org from Enterprise
Detaches a child organization from the enterprise. The child organization is not deleted and can continue to work afterwards.
The child org was removed successfully, a simple status is returned.
Invalid body
Account enterprise id mismatch
List all enterprise keys
Retrieves all keys of the enterprise
A list of enterprise service keys is returned on success.
Invalid query params
Generate a new Key for the Enterprise
Generate a new ServiceKey for the enterprise
A new Service Key is generated and saved to the Key collection
The supplied request is invalid or malformed.
The supplied request leads to an invalid state. The returned error will contain more helpful information.
Retrieve a specific entperise key
Retrieves a specific enterprise key by its id
.
The key with the supplied id
was found, the entire resource is returned.
Invalid query params
Delete an Enterprise ServiceKey
Delete an Enterprise ServiceKey from list of keys for the Enterprise
The Enterprise ServiceKey was deleted successfully, a simple status is returned.