Hosting your event log with a service dedicated to the task comes with some benefits which are tough to find in a homegrown solution. One example is that Loggr provides a flexible query language for querying your data (See http://docs.loggr.net/api/lql). Another benefit is being able to access your data from anywhere. Today I’m going to show you a real quick example of how to take advantage of both of those benefits to gets some quick stats from your app.
Open a terminal window (or command prompt on Windows). I’m going to be using the program CURL to make some simple web requests from the command line. Most system have this already (or a similar utility).
The first thing I’m going to do is get a list of people that have used my app today. The query is:
GET users OCCURS(TODAY) COLUMNS(username)
Using curl, we type (be sure to escape the spaces with + signs and include your Loggr apikey):
#curl "http://api.loggr.net/1/logs/testlog/query?query=GET+users+ OCCURS(TODAY)+COLUMNS(username)&apikey=4302702e3159c7"
We get back the following JSON response (truncated for brevity):
That was simple. Now let’s create an aggregate query to get a quick count of the users today. The query is:
GET users GROUPBY DAY OCCURS(TODAY) COLUMNS(KEY,COUNT)
Run that using curl:
#curl "http://api.loggr.net/1/logs/testlog/query?query=GET+users+ GROUPBY+DAY+OCCURS(TODAY)+COLUMNS(KEY,COUNT)&apikey=4302702e3159c7"
And we get:
Pretty easy to do at the command line. Now imagine piping those results into a dashboard like Geckoboard, or Ducksboard. You can always create your own dashboard hosted right out of Dropbox. See how we
We have recently added a Node.js package for Loggr which makes it really easy to post and read events from your Node application. You can find the package here. For details on how to install and use it, check out our docs http://docs.loggr.net/agents/nodejs.
DoubleTakeDeals uses Loggr in several of their products. Chris Walker, the Product Manager of their high-traffic deal site talks about the benefits he has seen over the past year by using Loggr for their monitoring. Click through the link below to read this new case study.