# serverless-plugin-metric

> Simplified way to create AWSL:Logs:MetricFilter resources using custom pattern-filter

Latest version **1.2.3** (published 2023-08-31) · ISC license · 0 weekly downloads

## Install

```sh
npm install serverless-plugin-metric
pnpm add serverless-plugin-metric
yarn add serverless-plugin-metric
bun add serverless-plugin-metric
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.2.3 |
| Published | 2023-08-31 |
| First published | 2018-01-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Alexandros Fotiadis |
| Maintainers | alex20465 |
| Keywords | aws, serverless, logging, metric, stats, plugin |

## Links

- npm: https://www.npmjs.com/package/serverless-plugin-metric
- Repository: https://github.com/alex20465/serverless-plugin-metric
- Homepage: https://github.com/alex20465/serverless-plugin-metric#readme
- Issues: https://github.com/alex20465/serverless-plugin-metric/issues
- npm.io page: https://npm.io/package/serverless-plugin-metric

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

- 1.2.3 (latest) — 2023-08-31
- 1.2.2 — 2019-09-26
- 1.2.1 — 2019-06-11
- 1.2.0 — 2019-06-05
- 1.1.0 — 2018-10-04
- 1.0.4 — 2018-04-15
- 1.0.3 — 2018-02-05
- 1.0.2 — 2018-02-05
- 1.0.1 — 2018-01-30
- 1.0.0 — 2018-01-29

## README

# Serverless Plugin Metric

A [serverless](http://www.serverless.com) plugin to automatically create `AWS:Logs:MetricFilter` resources.

## Requirements
- Node: >= 4.6.1
- Serverless: >= 1.24.1 (older versions not tested)

## Installation

NPM:

```
npm install serverless-plugin-metric --save-dev
```

Add the plugin to serverless.yml

```yaml
plugins:
  - serverless-plugin-metric
```

setup metrics:

```yaml
custom:
  metrics: # Array<MetricOption>
    - name: foo
      pattern: "{ $.statusCode != 200 }"
```

> Info: In order to display the metric on CloudWatch it is necessary to receive data.

## Metric option type-definitions:

```javascript
/** 
 * @typedef {object} MetricOption
 * @property {string} name              The name of the metric
 * @property {string} pattern           Filter patter doc (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html)
 * @property {string[]} [functions]     Default: ALL
 * @property {string} [namespace]       Override dynamic generated namespace (default: '<serviceName>/<stageName>')
 * @property {string} [value]           The value to apply to each occurence. (default: 1)
 */
```

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