winstonjs / node-loggly

A client implementation for Loggly in node.js
http://github.com/winstonjs/node-loggly
Other
233 stars 80 forks source link

Facet call returns search results. #7

Closed kordless closed 13 years ago

kordless commented 13 years ago

The facet call is currently returning search results instead of facet results. The documentation is also incorrect in showing an example of passing in rows to the facet call. Facets only support 'buckets'. Attempting to fix this issue and submit now.

kordless commented 13 years ago

remove rows key from facet call closed by 1dc6b5db77f7704c590158dbea5c5f9dd0cfb164

kordless commented 13 years ago

fixed

indexzero commented 13 years ago

Great. Have you tried running the tests though? I'm now seeing failures in the facet search tests. I don't know if this is related or if it's just a hiccup on your side, but I'd like to fix them before pushing 0.3.2:

  $ vows test/search-test.js --spec
  <...other passing tests...>
  When using the node-loggly client the facet() method when searching by ip
    ✗ should return a set of valid search results
      » expected null, got {
    stack: 'Error: Loggly Error (410): Gone\n    at [object Object].callback (/Users/Charlie/Nodejitsu/node-loggly/lib/loggly/interns.js:121:20)\n    at IncomingMessage. (/usr/local/lib/node/.npm/request/1.9.0/package/main.js:223:44)\n    at IncomingMessage.emit (events.js:59:20)\n    at HTTPParser.onMessageComplete (http.js:111:23)\n    at CleartextStream.ondata (http.js:1140:22)\n    at CleartextStream._push (tls.js:263:27)\n    at SecurePair._cycle (tls.js:514:18)\n    at EncryptedStream.write (tls.js:72:13)\n    at Socket.ondata (stream.js:15:26)\n    at Socket.emit (events.js:42:17)',
    arguments: undefined,
    type: undefined,
    message: 'Loggly Error (410): Gone'
} // helpers.js:62
When using the node-loggly client the facet() method when using chained searches
    ✗ should return a set of valid search results
      » expected null, got {
    stack: 'Error: Loggly Error (410): Gone\n    at [object Object].callback (/Users/Charlie/Nodejitsu/node-loggly/lib/loggly/interns.js:121:20)\n    at IncomingMessage. (/usr/local/lib/node/.npm/request/1.9.0/package/main.js:223:44)\n    at IncomingMessage.emit (events.js:59:20)\n    at HTTPParser.onMessageComplete (http.js:111:23)\n    at CleartextStream.ondata (http.js:1140:22)\n    at CleartextStream._push (tls.js:263:27)\n    at SecurePair._cycle (tls.js:514:18)\n    at EncryptedStream.write (tls.js:72:13)\n    at Socket.ondata (stream.js:15:26)\n    at Socket.emit (events.js:42:17)',
    arguments: undefined,
    type: undefined,
    message: 'Loggly Error (410): Gone'
} // helpers.js:62

Thanks.

kordless commented 13 years ago

It would appear the vow tests don't have a facet assert statement. Facets return a different data structure than regular searches. I don't have vows installed, so maybe you can patch it up. Here's the format:

{ gmt_offset: '-0800',
  data: 
   { '2011-02-12T01:00:00Z': 1,
     '2011-02-12T08:30:00Z': 7,
     '2011-02-12T21:00:00Z': 8,
     '2011-02-12T13:30:00Z': 6,
     '2011-02-12T23:30:00Z': 6,
     '2011-02-12T18:30:00Z': 11,
     '2011-02-12T06:00:00Z': 4,
     '2011-02-12T03:30:00Z': 5,
     '2011-02-12T11:00:00Z': 5,
     '2011-02-12T16:00:00Z': 14 },
  numFound: 67,
  context: 
   { rows: null,
     from: 'NOW-1DAY/HOUR',
     until: 'NOW+1HOUR/HOUR',
     start: 0,
     query: '404',
     order: 'desc' },
  gap: '+150MINUTES' }

Looks like you need 'data' instead of 'results'.