# good

> Server and process monitoring plugin

Latest version **8.1.2** (published 2019-01-19) · BSD-3-Clause license · 0 weekly downloads

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

## Install

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

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 8.1.2 |
| Published | 2019-01-19 |
| First published | 2013-02-14 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 17.3 KB |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 528 |
| Maintainers | arb, hueniverse, lloydbenson, marsup, nlf, wyatt |
| Keywords | process, monitor, log, report, hapi, plugin |

## Links

- npm: https://www.npmjs.com/package/good
- Repository: https://github.com/hapijs/good
- Homepage: https://github.com/hapijs/good#readme
- Issues: https://github.com/hapijs/good/issues
- npm.io page: https://npm.io/package/good

## Dependencies (4)

- [joi](https://npm.io/package/joi.md) 14.x.x
- [hoek](https://npm.io/package/hoek.md) 6.x.x
- [oppsy](https://npm.io/package/oppsy.md) 2.x.x
- [pumpify](https://npm.io/package/pumpify.md) 1.3.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

- 8.1.2 (latest) — 2019-01-19
- 8.1.1 — 2018-03-21
- 8.1.0 — 2018-02-12
- 8.0.1 — 2018-02-03
- 8.0.0 — 2018-01-29
- 8.0.0-rc1 — 2018-01-02
- 7.3.0 — 2017-08-23
- 7.2.0 — 2017-05-17
- 7.1.0 — 2016-12-01
- 7.0.2 — 2016-08-27
- 7.0.1 — 2016-05-19
- 7.0.0 — 2016-05-02
- 6.6.3 — 2016-04-21
- 6.6.2 — 2016-04-21
- 6.6.1 — 2016-04-21
- … 80 more at https://npm.io/package/good/versions

## README

![good Logo](images/good.png)

[**hapi**](https://github.com/hapijs/hapi) process monitoring

[![Build Status](https://secure.travis-ci.org/hapijs/good.svg)](http://travis-ci.org/hapijs/good)[![Current Version](https://img.shields.io/npm/v/good.svg)](https://www.npmjs.com/package/good)

Lead Maintainer: [Open position](https://github.com/hapijs/good/issues/589)

*good 8 only supports hapi 17+ for hapi 16 please use good 7*

**good** is a hapi plugin to monitor and report on a variety of hapi server events as well as ops information from the host machine. It listens for events emitted by hapi server instances and pushes standardized events to a collection of streams.

## Example Usage

```javascript
const Hapi = require('hapi');
const server = new Hapi.Server();

const options = {
    ops: {
        interval: 1000
    },
    reporters: {
        myConsoleReporter: [{
            module: 'good-squeeze',
            name: 'Squeeze',
            args: [{ log: '*', response: '*' }]
        }, {
            module: 'good-console'
        }, 'stdout'],
        myFileReporter: [{
            module: 'good-squeeze',
            name: 'Squeeze',
            args: [{ ops: '*' }]
        }, {
            module: 'good-squeeze',
            name: 'SafeJson'
        }, {
            module: 'good-file',
            args: ['./test/fixtures/awesome_log']
        }],
        myHTTPReporter: [{
            module: 'good-squeeze',
            name: 'Squeeze',
            args: [{ error: '*' }]
        }, {
            module: 'good-http',
            args: ['http://prod.logs:3000', {
                wreck: {
                    headers: { 'x-api-key': 12345 }
                }
            }]
        }]
    }
};

await server.register({
    plugin: require('good'),
    options,
});

await server.start();

console.info(`Server started at ${ server.info.uri }`);

```

This example does the following:

1. Sets up the reporter named `myConsoleReporter` listening for 'response' and 'log' events and writes them to `process.stdout`.
2. Sets up the reporter named `myFileReporter` to listen for 'ops' events and logs them to `./test/fixtures/awesome_log`.
3. Sets up the reporter named `myHTTPReporter` to listen for error events and POSTs them to `http://prod.logs:3000` with additional settings to passed into `Wreck`

See the [Reporter Interface section of the API documentation](https://github.com/hapijs/good/blob/master/API.md#reporter-interface) on how to configure reporters.

**NOTE**: Ensure calling `server.connection` prior to registering `Good`. `request` and `response` event listeners are only registered on connections that exist on `server` at the time `Good` is registered.

Looking for more examples? Check out the [examples folder](https://github.com/hapijs/good/tree/master/examples).

## Existing streams

The following streams are maintained by the hapi community and are known to work with good. Any transform or write stream can work with good, these are just a few inside the hapijs organization.

- [good-squeeze](https://github.com/hapijs/good-squeeze)
- [good-file](https://github.com/hapijs/good-file)
- [good-http](https://github.com/hapijs/good-http)
- [good-console](https://github.com/hapijs/good-console)

## API

See the [API Reference](API.md).

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