Skip to content

API simple que loggea cualquier request recibido

Notifications You must be signed in to change notification settings

ceroai/request-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Request Logging API

This is a simple API built with FastAPI that logs the details of every incoming HTTP request. It is designed to be deployed as a serverless container on Google Cloud Run.

Features

  • Catch-all Endpoint: Captures all requests (GET, POST, PUT, DELETE, etc.) to any URL path.
  • Structured Logging: Logs the following information for each request in JSON format to standard output:
    • URL
    • HTTP Method
    • Source IP Address (X-Forwarded-For header or remote address)
    • Request Payload (Body)
    • Request Headers
  • Containerized: Includes a Dockerfile for easy building and deployment.
  • Fast Dependencies: Uses uv for fast Python package management.

How it Works

The application uses a FastAPI middleware to intercept every request before it hits the endpoint. The middleware extracts the relevant information, formats it into a JSON object, and prints it to the console. Cloud Run automatically collects these logs, allowing you to view them in the Google Cloud Logging interface.

The main endpoint simply returns a 200 OK response with the message "Request logged".

Deployment to Google Cloud Run

(Instructions will be provided separately)

About

API simple que loggea cualquier request recibido

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •