DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • API Regression Testing for Event-Driven Systems: Catching Breaking Changes in Async APIs
  • Google Cloud Pub/Sub vs. AWS SNS and SQS: One Java API for Both With MultiCloudJ
  • Passwordless Image Pulls in Kubernetes With ServiceAccount Tokens and a Credential Provider
  • Zero Trust for Agents: A New Lens to Secure Agents

Trending

  • Microsoft Foundry Agent Debugging Dashboard with Microsoft Fabric Eventhouse, KQL, Docker and Grafana
  • Designing the Runtime Layer for Stateful AI Agents: Where Agent Substrate Fits
  • Member Spotlight: Shai Almong
  • Introducing senro: A Pipeline Engine You Program in Go

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Data Engineering
  3. Databases
  4. Announcing the Logz.io Search API

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.

By 
Daniel Berman
·
Jan. 11, 17 · News
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
4.8K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

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:

{  
  "hits":{  
     "total":984,
     "max_score":5.7908382,
     "hits":[  
        {  
"_index":"logz-xmywsrkbovjddxljvcahcxsrbifbccrh-161227_v2",
           "_type":"myfirewall",
           "_id":"avk9li_bmfctv-i4vosg",
           "_score":5.7908382,
           "_source":{  
              "geoip":{  
                 "timezone":"america/toronto",
                 "ip":"204.138.58.86",
                 "latitude":43.5924,
                 "continent_code":"na",
                 "city_name":"toronto",
                 "country_code2":"ca",
                 "country_name":"canada",
                 "country_code3":"can",
                 "region_name":"on",
                 "location":[  
                    -79.7611,
                    43.5924
                 ],
                 "real_region_name":"ontario",
                 "postal_code":"l5n",
                 "longitude":-79.7611
              },
 
"message":"<2016-12-27t20:31:13z><myfw-dc2>:src_ip=204.138.58.86,sport=4209,dst_ip=87.151.247.146,dport=443",
              "type":"myfirewall",
              "dst_ip":"87.151.247.146",
              "tags":[  
                 "_logz_http_bulk_json_8070",
                 "geoip"
              ],
              "src_ip":"204.138.58.86",
              "dport":443,
              "hostname":"myfw-dc2",
              "@timestamp":"2016-12-27t20:31:13.000+00:00",
              "sport":4209
           }
        }
     ]
  }

endnotes

  • 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!

API

Published at DZone with permission of Daniel Berman. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • API Regression Testing for Event-Driven Systems: Catching Breaking Changes in Async APIs
  • Google Cloud Pub/Sub vs. AWS SNS and SQS: One Java API for Both With MultiCloudJ
  • Passwordless Image Pulls in Kubernetes With ServiceAccount Tokens and a Credential Provider
  • Zero Trust for Agents: A New Lens to Secure Agents

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook