Event Count and Volume Endpoint APIs
Navigation Notice: When the APM Integrated Experience is enabled, Loggly shares a common navigation and enhanced feature set with other integrated experience products. How you navigate Loggly and access its features may vary from these instructions.
The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.
Loggly offers an endpoint that you can use to retrieve event counts and volume (optional). The endpoint to get events count and (optional) volume is:
https://<subdomain>.loggly.com/apiv2/events/count
Substitute your organization's subdomain name for <subdomain>
.
Usage
Call the endpoint with one or more parameters to get the count and optionally volume of events matching given search criteria.
Event Count Endpoint Request Parameters | ||
q | optional | query string, using Search Query Language. Defaults to "All" events. |
from | optional | Start time (in UTC) for the search. Defaults to "-24h". (See Time Ranges in Search.) |
until | optional | End time (in UTC) for the search. Defaults to "now". (SeeTime Ranges in Search.) |
include_volume | optional | true|false - if "true" returns also total size of events matching given query and time range in byte |
Requesting events volume via "include_volume" parameter makes the API call run longer because it needs to calculate the events size. If you need just the count make sure to not use the "include_volume" parameter to make the calls faster.
Events Count Endpoint Response Parameters | |
count | Number of events matching given search criteria |
volume | Total size of events matching given search criteria in bytes. This value is present only if the "include_volume=true" parameter is specified. |
Events Count Endpoint Usage Examples
Replace <token>
with your API token and <subdomain>
with your organization's subdomain.
Request event counts for the last 10 minutes
Endpoint:
curl -H 'Authorization: bearer <token>' -XGET 'https://<subdomain>.loggly.com/apiv2/events/count?q=*&from=-10m&until=now'
Output Example:
{ "count": 2635 }
Requesting events count and volume for the last 10 minutes
Endpoint:
curl -H 'Authorization: bearer <token>' -XGET 'https://<subdomain>.loggly.com/apiv2/events/count?q=*&from=-10m&until=now&include_volume=true'
Output Example:
{ "count": 2635, "volume": 5224576 }