S
Sprint Log Parser
Docs / Log Ingestion / Nginx Access Logs

Nginx Access Logs

Capture request streams, IP metadata, status codes, and user agents directly from your Nginx edge load balancers.

1. Auto Installer Setup

The simplest way to stream Nginx access logs is running the interactive cURL setup script. It automatically downloads the shipper script, prompts you for workspace information, and installs it as a background service:

curl -sS https://sprint-logparser.dev.5starcompany.com.ng/download/setup | sudo SERVER_URL="https://sprint-logparser.dev.5starcompany.com.ng" API_TOKEN="YOUR_API_TOKEN" bash

By running the command directly copied from your project dashboard, the installation script will automatically inherit your project token. It will only prompt you for the following log-specific details:

  • Instance Name: Enter `nginx` (or any custom identifier to isolate this daemon).
  • Log File Path to monitor: `/var/log/nginx/access.log`
  • Log Type: Select **1** (Nginx Combined Access Log).

2. Nginx Log Format

To allow the parser engine to successfully identify RCE attacks, SQL injections, and scraper anomalies, define the custom `megasprint` log format in the `http` block of your `/etc/nginx/nginx.conf` file:

log_format megasprint '$remote_addr - $remote_user [$time_local] '
                      '"$request" $status $body_bytes_sent '
                      '"$http_referer" "$http_user_agent"';

3. Enable Ingestion

Associate your virtual hosts server block to output access logs using the newly configured format:

server {
    listen 80;
    server_name example.com;

    access_log /var/log/nginx/access.log megasprint;
    error_log /var/log/nginx/error.log warn;
}

Reload Nginx configurations to apply:

sudo nginx -t && sudo systemctl reload nginx

4. Manual Shipper Configuration (Optional)

Alternatively, you can manually update the configuration file at `/etc/log-shipper.json`:

{
  "api_url": "https://sprint-logparser.dev.5starcompany.com.ng/api/projects/ingest",
  "api_token": "YOUR_WORKSPACE_INGESTION_TOKEN",
  "log_file": "/var/log/nginx/access.log",
  "log_type": "nginx_access"
}