Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Example of using node-loggly to graph using facet call.
branch: master

This branch is even with loggly:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
static
README.md
chart.js

README.md

node-loggly-graph

Example of using node-loggly with node.js and Google Charts.

Installation

Node.js, node-loggly, and paperboy are required to run this demo.

Installing

You'll need the latest node.js, npm (node package manager), node-loggly, and paperboy (static server) to run the demo. Leaving you to install node.js, here are the commands for installing the rest:

  curl http://npmjs.org/install.sh | sh
  [sudo] npm install loggly
  [sudo] npm install paperboy

Now grab the node-loggly-graph example project:

  curl https://github.com/loggly/node-loggly-graphs/tarball/master
  tar xvfz loggly* 
  cd loggly*

Configuring

Edit the chart.js file and put in your Loggly subdomain, username and password:

  // connect up to loggly
  var config = {
    subdomain: "geekceo",
    auth: {
      username: "kordless",
      password: "password"
    }
  };

On Loggly, create and copy a HTTP input key and replace the one I have in the code (unless you want to send logs to our account):

var lkey = 'a3e839e9-4827-49aa-9d28-e18e5ba5a818';

You can also edit the terms list in static/index.html to search facets for other terms:

  var terms = ['HTTP AND 200', 'HTTP AND 404', 'HTTP AND 302', 'HTTP AND 50*'];

Running

Start the server by doing a:

  node chart.js

Navigate to the page and check the APIs:

  http://machine.yourdomain.com/
  http://machine.yourdomain.com/api?query=404

Caveats and TODO

The facet searches only look for the occurrence of a given string, such as 'safari', and then total all the instances of that over all requests. Ideally you'd want to isolate and extract a sampling of user-agents over a shorter timeframe, dedup all the IP addresses and drop all the activty by bots.

Something went wrong with that request. Please try again.