Skip to content

Command Reference

Nicholas Cheek edited this page Jun 14, 2025 · 1 revision

Command Reference

Complete reference for all Laravel Log Parser commands and options.

Synopsis

logparse [OPTIONS] TARGET

Where TARGET is either:

  • Local file path: storage/logs/laravel.log
  • SSH host alias: production

Global Options

Input Sources

TARGET Local file path or SSH host alias --remote-path=PATH Remote log file path (default: storage/logs/laravel.log) --ssh-config=PATH SSH config file path (default: ~/.ssh/config)

Filtering Options

--level=LEVEL Filter by log level (DEBUG, INFO, WARNING, ERROR) --errors-only Show only ERROR and WARNING entries --since=DATE Show logs since date (YYYY-MM-DD or "YYYY-MM-DD HH:MM") --until=DATE Show logs until date (YYYY-MM-DD or "YYYY-MM-DD HH:MM") --search=TEXT Search for text in log messages (case-insensitive) --user=ID Filter by user ID --last=N Show only the last N entries

Output Options

--summary Show summary statistics --stats Show detailed statistics with user and file analysis --group-by=FIELD Group results by: message, level, file, user --json Output in JSON format --compact Use compact one-line format --no-color Disable colored output

Help and Information

--help Show help message --version Show version information

Examples by Use Case

Basic Usage

Parse local file

logparse storage/logs/laravel.log

Parse remote file

logparse production

Show help

logparse --help

Error Investigation

Show recent errors

logparse --errors-only --last=50 production

Find specific error

logparse --search="Call to undefined method" --errors-only production

Errors for specific user

logparse --user=123 --errors-only --since=today production

Time-Based Analysis

Today's activity

logparse --since=2024-01-15 production

Specific time window

logparse --since="2024-01-15 14:00" --until="2024-01-15 16:00" production

Recent entries

logparse --last=100 production

Statistical Analysis

Basic summary

logparse --summary production

Detailed statistics

logparse --stats --since=today production

Group similar errors

logparse --errors-only --group-by=message production

Export and Integration

Export to JSON

logparse --json --since=today production > logs.json

Compact format for scripts

logparse --compact --errors-only production

No colors for scripts

logparse --no-color production

Remote Server Analysis

Different log path

logparse --remote-path="app/logs/laravel.log" production

Custom SSH config

logparse --ssh-config="/etc/ssh/ssh_config" production

Exit Codes

  • 0 - Success
  • 1 - General error (invalid arguments, file not found)
  • 2 - SSH connection failed
  • 3 - Log parsing error

File Format Support

Laravel Log Parser supports the standard Laravel log format:

[YYYY-MM-DD HH:MM:SS] environment.LEVEL: message {"context":"data"}

Examples: [2024-01-15 14:30:45] production.ERROR: Call to undefined method {"userId":123} [2024-01-15 14:30:46] production.INFO: User logged in {"userId":456,"ip":"192.168.1.1"}

Environment Variables

Disable auto-colors for non-TTY

export NO_COLOR=1

Custom SSH config location

export SSH_CONFIG_FILE="/path/to/config"

Integration with Other Tools

With jq (JSON processing)

logparse --json production | jq '.[] | select(.level == "ERROR")'

With grep

logparse production | grep -i "database"

With awk

logparse --compact production | awk '/ERROR/ {print $3, $4}'

In Scripts

#!/bin/bash ERROR_COUNT=$(logparse --errors-only --since=today production | wc -l) if [ $ERROR_COUNT -gt 10 ]; then echo "High error rate detected: $ERROR_COUNT errors today" fi