{"id":22428231,"url":"https://github.com/technicallyjosh/pino-http-send","last_synced_at":"2025-08-01T10:32:37.788Z","repository":{"id":36578086,"uuid":"228497742","full_name":"technicallyjosh/pino-http-send","owner":"technicallyjosh","description":"A basic PinoJS http(s) transport with batching!","archived":false,"fork":false,"pushed_at":"2023-07-20T17:56:18.000Z","size":405,"stargazers_count":6,"open_issues_count":23,"forks_count":13,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-29T13:11:27.207Z","etag":null,"topics":["logger","pino","transport"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/technicallyjosh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-17T00:05:07.000Z","updated_at":"2024-07-18T14:16:45.000Z","dependencies_parsed_at":"2024-06-19T00:33:53.732Z","dependency_job_id":null,"html_url":"https://github.com/technicallyjosh/pino-http-send","commit_stats":{"total_commits":46,"total_committers":2,"mean_commits":23.0,"dds":"0.021739130434782594","last_synced_commit":"561b48ac75c084248a9caf35651ca53401f51534"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technicallyjosh%2Fpino-http-send","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technicallyjosh%2Fpino-http-send/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technicallyjosh%2Fpino-http-send/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technicallyjosh%2Fpino-http-send/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/technicallyjosh","download_url":"https://codeload.github.com/technicallyjosh/pino-http-send/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228363978,"owners_count":17908319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["logger","pino","transport"],"created_at":"2024-12-05T20:14:10.499Z","updated_at":"2024-12-05T20:14:11.653Z","avatar_url":"https://github.com/technicallyjosh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pino-http-send\n\nA basic handler for [pino](https://github.com/pinojs/pino) logs that sends batches to a desired\nendpoint via HTTP or HTTPS.\n\n[![npm](https://img.shields.io/npm/v/pino-http-send.svg?style=for-the-badge)](https://npmjs.com/package/pino-http-send)\n[![Travis (.org)](https://img.shields.io/travis/technicallyjosh/pino-http-send.svg?style=for-the-badge)](https://travis-ci.org/technicallyjosh/pino-http-send)\n[![David](https://img.shields.io/david/technicallyjosh/pino-http-send.svg?style=for-the-badge)](https://david-dm.org/technicallyjosh/pino-http-send)\n\n**_Pre v1 is subject to breaking changes on minor version change._**\n\n## Installation\n\n```console\n$ npm i pino-http-send\n```\n\n## Usage\n\n```console\n$ pino-http-send --help\npino-http-send [options]\n\nSending\n  --method, -m\n             [string] [choices: \"POST\", \"PUT\", \"PATCH\", \"GET\"] [default: \"POST\"]\n  --bodyType, -b   type of body to send\n                          [string] [choices: \"json\", \"ndjson\"] [default: \"json\"]\n  --url            url to send logs to                       [string] [required]\n  --batchSize, -s  how many logs to send at a time        [number] [default: 10]\n  --timeout, -t    timeout (in ms) to send logs in bucket that are not filled\n                                                        [number] [default: 5000]\n\nBasic Auth\n  --username, -u  basic auth username                                   [string]\n  --password, -p  basic auth password                                   [string]\n\nRetry\n  --retries, -r   number of retries to do if failure       [number] [default: 5]\n  --interval, -i  interval (in ms) to retry sending if failure\n                                                        [number] [default: 1000]\n\nOptions:\n  --help        Show help                                              [boolean]\n  --version     Show version number                                    [boolean]\n  --log, -l     log to console as well                [boolean] [default: false]\n  --silent      silence pino-http-send logs for failures and retries\n                                                      [boolean] [default: false]\n  --config, -c  path to json config                                     [string]\n```\n\n## Environment Variables\n\nAll options can be defined in the environment and are prefixed with `PINO_HTTP_SEND_`. All\ncamel-cased options are parsed with delimiters of `_`.\n\n_e.g. The option `batchSize` as an env var would be `PINO_HTTP_SEND_BATCH_SIZE`._\n\n## URL\n\n**Example**\n\n```console\n$ node . | pino-http-send --url=http://localhost:8080\n```\n\nYou can also do https...\n\n```console\n$ node . | pino-http-send --url=https://myserver.com:8080\n```\n\n## Body Type\n\n- `ndjson` - New-line delimited JSON. See [ndjson](https://github.com/ndjson/ndjson-spec)\n- `json` - Standard JSON sending of data. Logs are sent in the format of\n  ```json\n  {\n    \"logs\": [...logs]\n  }\n  ```\n\n## Auth\n\nCurrently only basic auth is implemented for the CLI usage. For header usage, you can see the API usage.\n\n## API\n\nYou can also use this module as a [pino destination](https://github.com/pinojs/pino/blob/master/docs/api.md#destination).\n\nThis will use the same batching function like the CLI usage. If the batch length\nis not reached within a certain time (`timeout`), it will auto \"flush\".\n\n### `createWriteStream`\n\nThe options passed to this follow the same values as the CLI defined above.\n\n| Property  | Type                    | Required/Default |\n| --------- | ----------------------- | ---------------- |\n| url       | `string`                | REQUIRED         |\n| log       | `boolean`               | false            |\n| silent    | `boolean`               | false            |\n| method    | `string`                | \"POST\"           |\n| bodyType  | `string`                | \"json\"           |\n| username  | `string`                |                  |\n| password  | `string`                |                  |\n| headers   | `Record\u003cstring,string\u003e` |                  |\n| batchSize | `number`                | 10               |\n| retries   | `number`                | 5                |\n| interval  | `number`                | 1000             |\n| timeout   | `number`                | 5000             |\n| config    | `string`                |                  |\n\n```ts\nimport { createWriteStream } from 'pino-http-send';\n\nconst stream = createWriteStream({\n  url: 'http://localhost:8080',\n});\n\nconst logger = pino(\n  {\n    level: 'info',\n  },\n  stream,\n);\n\nlogger.info('test log!');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechnicallyjosh%2Fpino-http-send","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechnicallyjosh%2Fpino-http-send","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechnicallyjosh%2Fpino-http-send/lists"}