Sign inSign up

kevinypfan/log-generator

By kevinypfan

•Updated over 1 year ago

A simple HTTP service for generating JSON-formatted logs of specified sizes

Image
0

250

kevinypfan/log-generator repository overview

⁠Log Generator

Docker Pulls Docker Image Size

A simple HTTP service for generating JSON-formatted logs of specified sizes. This tool is useful for testing log system performance, storage capacity, or simulating log generation scenarios.

GitHub Repository⁠ | Docker Hub⁠

⁠Features

  • Generate JSON-formatted logs with controllable sizes
  • HTTP API support
  • Winston for log processing
  • Docker support
  • Console log output

⁠Tech Stack

  • Node.js 22
  • Express.js
  • Winston (Log Processing)
  • Docker

⁠Quick Start

# Pull and run the container
docker run -p 3000:3000 -d kevinypfan/log-generator

The service will be available at http://localhost:3000⁠

⁠Local Build

If you want to build the image yourself:

git clone https://github.com/kevinypfan/log-generator.git
cd log-generator
docker build -t log-generator .
docker run -p 3000:3000 -d log-generator
⁠Local Development
# Install dependencies
npm install

# Start the service
npm start

⁠API Documentation

⁠Generate Log
GET /log?bytes=<size>

Parameters:

  • bytes: Specify the size of the generated log (unit: bytes, default: 100)

Example:

# Generate a log of approximately 500 bytes
curl "http://localhost:3000/log?bytes=500"

Response format:

{
  "message": "Log generated",
  "requestedBytes": "500",
  "actualBytes": 523,
  "logObject": {
    "message": "Generated log of approximately 500 bytes",
    "targetBytes": 500,
    "actualBytes": 523,
    "variation": 3,
    "randomContent": "...",
    "finalSize": 523
  }
}

⁠Key Features

  1. Size Variation: The actual log size will have a random variation of ±10 bytes from the requested size to simulate real scenarios
  2. JSON Format: All logs are output in structured JSON format
  3. Console Output: Logs are output to the console for easy viewing and debugging

⁠Container Information

  • Base Image: node:22-alpine
  • Exposed Port: 3000
  • Container Size: Minimized (using Alpine Linux)
⁠Environment Variables

No required environment variables at this time.

⁠Persistence

All logs are output to the console and can be viewed using docker logs.

⁠Versions

  • latest: Most recent version
  • 1.x.x: Specific version tags

Tag summary

Content type

Image

Digest

sha256:328f49a1a…

Size

55.4 MB

Last updated

over 1 year ago

docker pull kevinypfan/log-generator