open-index/open-npm huggingface dataset:
npm package: @hyperwatch/express-logger
Description: Express.js middleware to log HTTP requests to Hyperwatch.
Author: François Hodierne
Latest version: 3.1.0

# Hyperwatch Express Logger

An Express.js middleware to log HTTP requests to Hyperwatch and compatible software.

## Install

```
npm install --save @hyperwatch/express-logger
```

## Usage

### Using the Syslog protocol

On Hyperwatch side, make sure you have a Syslog input that parse logs in the JSON standard format.

Then:

```
const express = require('express')
const hyperwatchExpressLogger = require('@hyperwatch/express-logger')

const app = express()

app.use(hyperwatchExpressLogger('syslog', '0.0.0.0', 1516)
```

### Using the HTTP protocol

On Hyperwatch side, make sure you have an HTTP input that parse logs in the JSON standard format.

Then:

```
const express = require('express')
const hyperwatchExpressLogger = require('@hyperwatch/express-logger')

const app = express()

app.use(hyperwatchExpressLogger('http', 'http://0.0.0.0:3000/input/log'))
```

### Using the Websocket protocol

On Hyperwatch side, make sure you have a WebSocket input that parse logs in the JSON standard format.

```
const express = require('express')
const hyperwatchExpressLogger = require('@hyperwatch/express-logger')

const app = express()

app.use(hyperwatchExpressLogger('websocket', 'ws://0.0.0.0:3000/input/log'))
```

## License

[Apache License, version 2](LICENSE)
npm package: @hyperwatch/hyperwatch
Description: Open Source HTTP Traffic Manager
Author: François Hodierne
Latest version: 4.2.0

[![NPM version](https://img.shields.io/npm/v/@hyperwatch/hyperwatch)](https://www.npmjs.com/package/@hyperwatch/hyperwatch) [![Build Status](https://github.com/hyperwatch/hyperwatch/workflows/CI/badge.svg)](https://github.com/hyperwatch/hyperwatch/actions?query=workflow%3ACI)

Hyperwatch is a flexible access log processor that helps operators analyze HTTP traffic reaching their infrastructure.

Hyperwatch is built on a real-time stream processor handling logs from inputs of any type:

- CDNs (Cloudfront, Cloudflare, Akamai, ...)
- Load Balancers (ELB)
- Reverse Proxies (Nginx, Haproxy, ...)
- Web Servers (Nginx, Apache, ...)
- Applications (Node, Ruby, PHP, ...)

## Install

Make sure you have Node.js version >= 14.

We recommend using [nvm](https://github.com/creationix/nvm): `nvm install && nvm use`.

```bash
git clone https://github.com/hyperwatch/hyperwatch.git
cd hyperwatch
npm install
```

## Start

```bash
npm start
```

It's loading the default configuration, it's the same as:

```bash
npm start config/default
```

## Configure

The first thing you might want is configuring inputs to connect Hyperwatch to your traffic sources and convert it in the proper format.

In order to do this, you need to create a new configuration file such as `config/custom.js`.

See [Input Configuration](./docs/input.md) for the list of available input types and how to configure them.

There are also a couple of constants you might configure with a simple config file, to learn more you can head to [Constants Configuration](./docs/configuration.md).

### Start with custom configuration

```shell
npm start config/custom
```

The Hyperwatch API and Websocket will be served from port `3000` by default.

You can change that using an environment variable:

```shell
PORT=80 npm start config/custom
```

## License

[Apache License, version 2](LICENSE)
npm package: @hyperwatch/useragent
Description: User Agent parser
Author: François Hodierne
Latest version: 3.9.3

[![NPM version](https://img.shields.io/npm/v/@hyperwatch/useragent)](https://www.npmjs.com/package/@hyperwatch/useragent) [![Build Status](https://github.com/hyperwatch/useragent/workflows/CI/badge.svg)](https://github.com/hyperwatch/useragent/actions?query=workflow%3ACI)

This is Hyperwatch's User Agent parser for Node.js.

It's fast and detects more user agents that any other similar libraries.

It's derived from [UAP Core](https://github.com/ua-parser/uap-core) and forked from [3rd-Eden useragent](https://github.com/3rd-Eden/useragent).

It's using an innovative approach, it doesn't try to target each known user agent but instead targets generic patterns. It allows the library to be more exhaustive, it doesn't need to contain a single rule for each user agent and it doesn't need to be updated each time there is a new active user agent in the wild.

It's much faster because it's containing fewer regexes than predecessors, it's starting with a plain text "pre-parsing" to lower even more the number of regexes to execute.

## Install

```bash
npm install --save @hyperwatch/useragent
```

## Usage

In short:

```js
const useragent = require('@hyperwatch/useragent');

const agent = useragent.parse(
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:82.0) Gecko/20100101 Firefox/82.0'
);

console.log(agent);
```

Returns:

```js
{
  family: 'Firefox',
  major: '82',
  minor: '0',
  patch: null,
  patch_minor: null,
  source: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:82.0) Gecko/20100101 Firefox/82.0'
}
```

For more details, [read the dedicated API documentation](docs/API.md).

## Regexes

### First

This set contains today 2 regular expressions.

It aims to contain generic regexes that can parse enough user agents that it's justified to run them every single time as first.

### Core

This set contains today around 90 regular expressions in 20 families.

A plain text pre-parser is triggered first to recognize the user agent family, it then iterates over all regexes in the family, order matters.

### Extra

This set contains non-generic regexes targeting user agents that are not recognized by the 'First' or 'Core' sets. Sometimes it's acceptable to fall back on 'UAP' instead of adding a rule in 'Extra'. We're usually adding rules in 'Extra' for the following reasons:

- for coverage: to increase the success rate of our own Hyperwatch regex sets
- for performance: because it's faster to skip UAP and use our own Hyperwatch regex sets
- because it's not supported by UAP anyway

### UAP

If it's not able to provide a result with the 'First', 'Core' and 'Extra' sets, it uses UAP as a fallback.

Also, it's still using UAP for Device and OS parsing as this is not a focus of the library at this time.

## License

[Apache License, version 2](LICENSE)