query-logentries
Query logentries.com via their REST API. Returns only the raw log messages you passed to logEntries at the time of logging. Supports both callback and streaming and uses request-retry-stream internally to make requests in order to be more robust in case of network glitches.
Installation
npm install --save query-logentries
Usage
How to initialize and available options:
const queryLogentriesFactory = ; // Required. Replace with your API KEYconst apiKey = '6971aef7-998f-4cb2-9613-ddb42b9697b8'; // Optional. Defaults to https://rest.logentries.com/query/logsconst queryUrl = 'https://rest.logentries.com/query/logs'; const queryLogentries = ;const opts = // Required. Set it to the id of the log in logEntries you wish // to query logId: '7d9ff278-3a6d-4c7a-8e65-df89fd3f5a96' // Required. Set it to any valid value or stringDate that can //be passed to a javascript Date object from: '2017-01-01T00:00:00.000' // Optional. If empty will default to now. Set it to any valid // value or stringDate that can be passed to a javascript Date // object to: '2017-01-02T23:59:59.999' // Optional. Default to 'where()'. The leql query you wish to // query with. Please ensure it is a valid leql query or you // get statusCode 400 errors from logEntries. query: 'where(method=GET)' // Optional. Defaults to 50. How many messages should be // retrieved per paging request made to logEntries perPage: 50 // Optional. Defaults to 30000 (30 seconds). How long should //the request wait before it times out timeout: 30000 // Optional. Defaults to 3000 (3 seconds). How long should // this module wait when checking if a query response is // finished on logEntries pollInterval: 3000;
After initializing, using it with callback:
;
After initializing, using it with streaming:
const pump = ;const through2 = ;const fs = ; const logEntriesStream = ;const toStringStream = through2;const toFileStream = fs; ;