Posting Events
Events are the primary entities in Loggr. You can think of Loggr as a big database of events for your application. This article will attempt to give you an understanding of what events are, how your application posts them and some tips on developing a taxonomy of events for your application.
A Quick ExampleMore Advanced ExampleTry It OnlinePosting From Your Application
A Quick Example
Note
This example walks you through posting an event via the command line. We have agents that you can download into your app to make things a lot easier. See the bottom of this page.
First let’s see a very quick example of how events get into Loggr. Loggr speaks HTTP, so with a basic tool like telnet or curl you can post events. We recommend using curl for testing out the various features of Loggr. There is also an online version of curl, called hurl. Before posting to your log, you’ll need your
LOGKEY and your
APIKEY. If you haven’t created a log yet, do that first.
Find your LOGKEY

You chose a LOGKEY when you created your log. When viewing your log in the browser you can find it in the URL as shown below. This LOGKEY will be used whenever you are posting events or reading events throught the Loggr API.
Find your APIKEY

Finding your APIKEY will take a couple more steps. Again, view your log in a browser, then view your log settings to find the APIKEY. Click the settings button on the toolbar in Loggr. This will bring up your log settings popup. Click to the API KEYS tab at the left of the popup and you’ll see a list of your keys.
Code for posting
With your LOGKEY and APIKEY you’re ready to post your first event.
Break out your command prompt and enter the following curl command.
curl -X POST -d "text=my+first+event
&apikey=db961642e48e48e4ab00ef60c90fa29e"
http://post.loggr.net/1/logs/myfirstlog/events
Command LineIf everything went right, you should see your first event listed in Loggr like below.

If you don’t see your event listed, you probably got an error. Most errors will get reported by curl when the request completes. (In some cases an error may not report a human-readable error. Try adding the
-v option to the curl call. This will show request and response headers, which should give you more information).
Note
When an event is posted to Loggr, but has "bad" event information, you will get an error event in your log with details on what was wrong.
More Advanced Example
The above example won't get you too far. In that example you only sent a simple text message. You'll want to include more data in your events to make them more useful. Try adding some tags and a source (tags are space-delimited strings).
curl -X POST -d
"text=my+first+event&tags=tag1+tag2&source=curl
&apikey=db961642e48e48e4ab00ef60c90fa29e"
http://post.loggr.net/1/logs/myfirstlog/events
Command LineIf you look at the event that was posted, you'll see both tags and the source. Click on them to filter your events by them. Next we'll add an event that represents an imaginary purchase.
curl -X POST -d
"text=2+Large+Pillows&tags=purchase+online
&user=dave.weaver&value=35.00
&geo=40.1203,-76.2944&source=curl
&apikey=db961642e48e48e4ab00ef60c90fa29e"
http://post.loggr.net/1/logs/myfirstlog/events
Command LineThis event includes details about the purchase of 2 Large Pillows for a total of $35.50, made by user dave.weaver from somewhere around Lancaster, PA. Check out this event in your log. Click on the
VIEW button to see the location. You can use the other tools in Loggr to do analysis on the Value as well.
You can do a combination of the examples above to create a rich event log. Obviously this is not how you’re going to be posting events from your app, but this is a good way to get an understanding of how events are posted.
top
Try It Online
You can try the Javascript agent online using a Javascript testbed. Make sure you know your
LOGKEY and APIKEY.
Try posting eventstop
Posting From Your Application
Since posting events to Loggr is a simple HTTP call, you should be able to make your app do that pretty easily. Although using an already-baked "agent" library for your platform would be a better choice. We have started a repository of "agent" libraries on GitHub (
). Please feel free to download and use/modify those libraries. Keep in mind, we're just starting to post those libraries.
Read more about our Loggr agentstop