Over a million developers have joined DZone.

Announcing the Logz.io Search API

DZone 's Guide to

Announcing the Logz.io Search API

Logz.io has announced a new API that will enable users to safely and securely query the data that they are shipping to Logz.io using the Elasticsearch Search API DSL.

· Integration Zone ·
Free Resource

There’s nothing like starting a new year with new product-related announcements! In this case, I’m happy to inform our users of a new Search API that will enable them to safely and securely query the data that they are shipping to Logz.io using the Elasticsearch Search API DSL.

This API replaces the older Query API, which was much more limited in scope and capabilities and will be deprecated in a few months.

Why would you use the API to query Elasticsearch instead of Kibana? Well, you could, for example, integrate with the API to create some kind of baseline for monitoring new services. As soon as a new service or host registers, you could use the API to match which of them are logging into Elasticsearch.

Below are some general guidelines on the API along with explanations of existing limitations and one simple example of how to use it.

Licensing and Limitations

For now, only our enterprise users will have access to the Search API. Likewise, we are currently limiting the number of search results to 10,000 (with paging).

Queries can only be performed against data shipped over the prior two days (the current day and the one preceding it).

API Tokens

To use the Search API, you will first need to retrieve an API token. The token can be generated on the User Tokens page in your account’s user settings:

user tokens

Using the API

Once you have the token, you can begin querying your data.

First, build your query in JSON format in a file. You can refer to the Elasticsearch Search API documentation for guidance on how to build the query.

For example, I’m going to query my account for a simple string and limit the search to one response:

   "from" : 0, "size" : 1,
    "query": {
        "query_string": {
            "query": "canada"

Then, build your API as follows (replace API-TOKEN with your token and QUERY with the path to your query file):

curl -XPOST 'https://api.logz.io/v1/search' --header "X-USER-TOKEN: <API-TOKEN>" --header "Content-Type: application/json" --data-binary @<QUERY>

And the response:



  • Be sure to use HTTPS in the request URL. An HTTP request will result in a “403” response.
  • The request body needs to comply with the Elasticsearch Search API. There are, however, some limitations that we highly recommend you review before you begin using the API.
  • More examples and documentation are available here.

We’d love to get your feedback. If you encounter any bugs, please open an issue on GitHub or send us your comments to: support (at) logz.io.

Happy querying!

search api ,logz.io ,integration ,queries ,elasticsearch

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}