# node-loggly-bulk

> A client implementation for Loggly cloud Logging-as-a-Service API

Latest version **4.0.2** (published 2024-08-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-loggly-bulk
pnpm add node-loggly-bulk
yarn add node-loggly-bulk
bun add node-loggly-bulk
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2024-08-14 |
| First published | 2016-06-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/node-loggly-bulk) |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 3 |
| Unpacked size | 236.1 KB |
| Known vulnerabilities | 0 (+30 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Charlie Robbins |
| Maintainers | loggly-hoover, swi_npm_public |
| Keywords | cloud computing, api, logging, loggly |

## Links

- npm: https://www.npmjs.com/package/node-loggly-bulk
- Repository: https://github.com/loggly/node-loggly-bulk
- Homepage: https://github.com/loggly/node-loggly-bulk#readme
- Issues: https://github.com/loggly/node-loggly-bulk/issues
- npm.io page: https://npm.io/package/node-loggly-bulk

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) 1.7.4
- [moment](https://npm.io/package/moment.md) 2.29.4
- [json-stringify-safe](https://npm.io/package/json-stringify-safe.md) 5.0.x

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 4.0.2 (latest) — 2024-08-14
- 2.2.4-beta (beta) — 2018-07-25
- 2.2.1-beta (next) — 2017-11-29
- 4.0.1 — 2023-04-15
- 3.0.1 — 2021-11-16
- 3.0.0 — 2021-03-22
- 2.2.5 — 2021-03-09
- 2.2.4 — 2018-08-01
- 2.2.3 — 2018-07-06
- 2.2.3-beta — 2018-06-27
- 2.2.2 — 2018-03-15
- 2.2.2-beta — 2018-02-21
- 2.2.1 — 2017-12-06
- 2.2.0 — 2017-11-13
- 2.1.0 — 2017-11-08
- … 10 more at https://npm.io/package/node-loggly-bulk/versions

## README

# node-loggly-bulk

[![Version npm](https://img.shields.io/npm/v/node-loggly-bulk.svg?style=flat-square)](https://www.npmjs.com/package/node-loggly-bulk)[![npm Downloads](https://img.shields.io/npm/dm/node-loggly-bulk.svg?style=flat-square)](https://www.npmjs.com/package/node-loggly-bulk)

[![NPM](https://nodei.co/npm/node-loggly-bulk.png?downloads=true&downloadRank=true)](https://nodei.co/npm/node-loggly-bulk/)

A client implementation for Loggly in node.js. Check out Loggly's [Node logging documentation](https://www.loggly.com/docs/nodejs-logs/) for more.

## Usage

The `node-loggly-bulk` library is compliant with the [Loggly API][api]. Using `node-loggly-bulk` you can send logs to Loggly.

### Getting Started
Before we can do anything with Loggly, we have to create a client with valid credentials. We will authenticate for you automatically:

``` js
  var loggly = require('node-loggly-bulk');

  var client = loggly.createClient({
    token: "your-really-long-input-token",
    subdomain: "your-subdomain",
    //
    // Optional: Tag to send with EVERY log message
    //
    tags: ['global-tag']
  });
```

### Logging
There are two ways to send log information to Loggly via node-loggly-bulk. The first is to simply call client.log with an appropriate input token:

``` js
  client.log('127.0.0.1 - There\'s no place like home', function (err, result) {
    // Do something once you've logged
  });
```

Note that the callback in the above example is optional, if you prefer the 'fire and forget' method of logging:

``` js
  client.log('127.0.0.1 - There\'s no place like home');
```

### Logging with Tags

If you're using Loggly's [tags](https://www.loggly.com/docs/tags/) functionality, simply include an array of tags as the second argument to the `log` method:

``` js
  client.log('127.0.0.1 - There\'s no place like home', [ 'dorothy' ], function (err, result) {
    // Do something once you've logged
  });
```

*note* Tags passed into the log function will be merged with any global tags you may have defined.


### Logging Shallow JSON Objects as a String
In addition to logging pure strings, it is also possible to pass shallow JSON object literals (i.e. no nested objects) to client.log(..) or input.log(..) methods, which will get converted into the [Loggly recommended string representation][sending-data]. So

``` js
  var source = {
    foo: 1,
    bar: 2,
    buzz: 3
  };

  input.log(source);
```

will be logged as:

```
  foo=1,bar=2,buzz=3
```

### Logging JSON Objects
It is also possible to log complex objects using the new JSON capabilities of Loggly. To enable JSON functionality in the client simply add 'json: true' to the configuration:

``` js
  var config = {
    token: 'token',
    subdomain: "your-subdomain",
    json: true
  };
```

When the json flag is enabled, objects will be converted to JSON using JSON.stringify before being transmitted to Loggly. So

``` js
  var source = {
    foo: 1,
    bar: 2,
    buzz: {
      sheep: 'jumped',
      times: 10
    }
  };

  input.log(source);
```

will be logged as:

``` json
  { "foo": 1, "bar": 2, "buzz": {"sheep": "jumped", "times": 10 }}
```

### Logging arrays
It is possible to send arrays, which will result in one single request to Loggly.

``` js
  input.log([ {iam:'number 1'}, {iam:'number 2'} ])
```

## Installation

### Installing npm (node package manager)
``` bash
  $ curl http://npmjs.org/install.sh | sh
```

### Installing node-loggly-bulk
``` bash
  $ npm install node-loggly-bulk
```

## Run Tests

``` bash
  $ npm run test
```



#### Author: [Charlie Robbins](http://www.github.com/indexzero)
#### Contributors: [Marak Squires](http://github.com/marak), [hij1nx](http://github.com/hij1nx), [Kord Campbell](http://loggly.com), [Erik Hedenström](http://github.com/ehedenst),

[api]: http://www.loggly.com/docs/api-overview/
[sending-data]: http://www.loggly.com/docs/api-sending-data/
[search-api]: http://www.loggly.com/docs/api-retrieving-data/
[search]: http://www.loggly.com/docs/search-overview/
[vows]: http://vowsjs.org

---
_Source: https://npm.io/package/node-loggly-bulk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
