# splunkstorm

> client for the splunkstorm api

Latest version **2.0.1** (published 2014-12-12) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install splunkstorm
pnpm add splunkstorm
yarn add splunkstorm
bun add splunkstorm
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2014-12-12 |
| First published | 2013-06-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10 |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Manuel Ernst |
| Maintainers | nherment, zaphod1984 |
| Keywords | splunk, splunkstorm, logging, client, logs, log aggregation, key value pairs |

## Links

- npm: https://www.npmjs.com/package/splunkstorm
- Repository: https://github.com/zaphod1984/splunkstorm
- Issues: https://github.com/zaphod1984/splunkstorm/issues
- npm.io page: https://npm.io/package/splunkstorm

## Dependencies (1)

- [request](https://npm.io/package/request.md) ^2.51.0

## 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

- 2.0.1 (latest) — 2014-12-12
- 2.0.0 — 2014-12-12
- 1.1.0 — 2014-11-24
- 1.0.0 — 2014-10-11
- 0.1.0 — 2013-06-11

## README

# splunkstorm [![Build Status](https://travis-ci.org/zaphod1984/splunkstorm.png)](https://travis-ci.org/zaphod1984/splunkstorm)

[![NPM](https://nodei.co/npm/splunkstorm.png)](https://nodei.co/npm/splunkstorm/)

[![NPM](https://nodei.co/npm-dl/splunkstorm.png?months=3)](https://nodei.co/npm/splunkstorm/)

## Installation

````bash
$ npm i splunkstorm --save
````

## Usage

In order for the examples to work, you'll need a SplunkStorm account.
If you don't already have one, you can get one from http://www.splunkstorm.com

From your freshly set up account you'll need the SplunkStorm credentials the consist of your access token, your project Id and a API Hostname:

<p align="center">
  <img src="https://raw.github.com/zaphod1984/splunkstorm/master/img/credentials.png" width="350" />
</p>


## Example
````javascript
var SplunkStorm = require('splunkstorm');

var logger = new SplunkStorm({
    apiKey: 'you-api-key',
    projectId: 'your-project-id',
    apiHostName: 'your-api-host-name'
});

logger.send('foo=bar', null, null, null, function(error) {
    //error is null if everything went well
});

````

### Splunkstorm(options)
The constructor creates a SplunkStorm instance which is used to log to the backend.
It accepts a options hash consisting of:
* `apiKey`: your API Key which identifies your user account
* `projectId`: a SplunkStorm account is organized in projects which are used to categorize log messages
* `apiHostName`: the hostname assigned to you by SplunkStorm
* `formatter`: the strategy that is used to convert non string messages. possible values: `kvp` (default) and `json`

### Splunkstorm#send(logMessage, sourceType, host, source, callback)
The `send` method is used to send acctual log messages and accepts five parameters:

* `message`: accepts strings and objects, if an object has been assigned it will automatically be json-stringified.
* `sourceType`: the source of the log message, defaults to syslog
* `host`: the hostname, optional
* `source`: specify a source, optional
* `callback`: called upon completion, the callback accepts an error parameter which is null if no error has appeard

## Formatters
Splunk advocates the usage of key-value pairs in their Best-Practices section: http://dev.splunk.com/view/logging-best-practices/SP-CAAADP6
 
 Because of this starting with v2.0 `splunkstorm` will convert every non string value to a key-value pair string representation.
 By using the `formatter` option for the `splunkstorm` constructor one can opt into the legacy method of JSON-stringifying.
 
 ### Examples
 
 object  | string representation
 ------------- | -------------
 `{"a":"b"}`  | `a=b`
 `{"a":"b    b", "b": "c\n\nc"}`  | `a="b b", b="c c"`
 `{"a":"b\" b"}`  | `a="b' b"`
 
## Used in
- **winston-splunkstorm** https://github.com/zaphod1984/winston-splunkstorm

Happy logging!

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