# connect-request-logger-pg

> log http requests to postgres

Latest version **0.0.7** (published 2013-12-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install connect-request-logger-pg
pnpm add connect-request-logger-pg
yarn add connect-request-logger-pg
bun add connect-request-logger-pg
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2013-12-05 |
| First published | 2013-09-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Known vulnerabilities | 0 (+14 in 4 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Lalit Kapoor |
| Maintainers | lalitkapoor |
| Keywords | http, express, connect, postgres, logging, logger, requests, middleware |

## Links

- npm: https://www.npmjs.com/package/connect-request-logger-pg
- Repository: https://github.com/goodybag/connect-request-logger-pg
- npm.io page: https://npm.io/package/connect-request-logger-pg

## Dependencies (7)

- [pg](https://npm.io/package/pg.md) 2.6.x
- [async](https://npm.io/package/async.md) 0.2.x
- [lodash](https://npm.io/package/lodash.md) 2.0.x
- [moment](https://npm.io/package/moment.md) 2.2.x
- [express](https://npm.io/package/express.md) 3.4.x
- [mongo-sql](https://npm.io/package/mongo-sql.md) 2.x.x
- [node-uuid](https://npm.io/package/node-uuid.md) 1.4.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

- 0.0.7 (latest) — 2013-12-05
- 0.0.6 — 2013-12-04
- 0.0.5 — 2013-12-04
- 0.0.4 — 2013-12-04
- 0.0.3 — 2013-10-16
- 0.0.2 — 2013-10-08
- 0.0.1 — 2013-09-18

## README

## Connect Request Logger for PostgreSQL

Log http request to postgres.
- Automatically does table partitioning by year/month/week/day (default: month)
- Stores user defined fields (looks at properties attached to the req object, supports nested properties as well)
  - e.g. `{uuid: 'uuid'}`
  - e.g. `{foo: ['query', 'foo']}`


### Example
```javascript
var uuid = require('node-uuid');
var express = require('express');
var requestLogger = require('./');

var app = express();

app.use(function(req, res, next) {
  req.uuid = uuid.v1();
  next();
});

app.use(requestLogger({
  connStr: 'postgres://localhost:5432/test'
, table: 'requests'
, plan: 'month'
, customFields: {uuid: 'uuid'}
}));

app.get('/hello', function(req, res){
  var body = 'Hello World';
  res.setHeader('Content-Type', 'text/plain');
  res.setHeader('Content-Length', body.length);
  res.end(body);
});

app.listen(3000);
console.log('Listening on port 3000');
```

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