home / skills / codyswanngt / lisa / ops-check-logs

This skill helps you view and filter logs across local processes, browser, device, and remote CloudWatch to diagnose issues quickly.

npx playbooks add skill codyswanngt/lisa --skill ops-check-logs

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
6.5 KB
---
name: ops-check-logs
description: Check application logs from local processes, browser console, React Native device logs, or remote AWS CloudWatch. Supports log tailing, filtering, and error searching across all platforms.
allowed-tools:
  - Bash
  - Read
---

# Ops: Check Logs

View and search logs across all platforms and environments.

**Argument**: `$ARGUMENTS` — target and optional filter (e.g., `dev errors`, `staging api`, `local`, `browser`, `device ios`, `production {function}`)

## Path Convention

- **Frontend**: Current project directory (`.`)
- **Backend**: `${BACKEND_DIR:-../backend-v2}` — set `BACKEND_DIR` in `.claude/settings.local.json` if your backend is elsewhere

## Discovery

1. Read backend `package.json` to discover `logs:*`, `logs:watch:*`, and `aws:signin:*` scripts
2. Extract function names from `logs:{env}` scripts (typically set via `FUNCTION_NAME` env var)
3. Read `.env.{environment}` to find Sentry DSN for error correlation

## Local Process Logs

Local services run in foreground processes. Their logs are captured in the terminal where they were started.

- **Frontend**: stdout from `bun start:local` or `bun start:dev` (Metro bundler)
- **Backend**: stdout from `IS_OFFLINE=true bun run start:local` (Serverless Offline)

If services were started via the `ops-run-local` skill with `run_in_background`, check the background task output file.

## Browser Console Logs (Expo Web)

For inspecting JavaScript errors, warnings, and `console.log` output in the browser at runtime.

### Via Playwright MCP Tools (automated)

Use when you need to capture browser logs programmatically during UAT or debugging.

1. **Load Playwright tools** — use `ToolSearch` to search for `playwright browser`.

2. **Navigate to the app**:
   - `browser_navigate` to the target URL (discover from `e2e/constants.ts` or `.env.*` files)

3. **Capture console messages**:
   - `browser_console_messages` — returns all `console.log`, `console.warn`, `console.error` output

4. **Check for failed network requests**:
   - `browser_network_requests` — shows all HTTP requests including 4xx/5xx failures

5. **Run custom JS to inspect state**:
   - `browser_evaluate` with script: `JSON.stringify(performance.getEntriesByType('resource').filter(r => r.duration > 1000).map(r => ({name: r.name, duration: r.duration})))`

### Via Browser DevTools (manual)

When a developer is debugging interactively:

1. Open the app in Chrome (`http://localhost:8081`)
2. Open Chrome DevTools: `Cmd+Option+I` (macOS) or `F12`
3. **Console tab** — JS errors, warnings, and log output
4. **Network tab** — failed API requests (filter by `4xx` or `5xx`)
5. **Performance tab** — runtime performance profiling

## React Native Device Logs

For inspecting logs on iOS and Android devices/simulators when running the native app.

### React Native DevTools (primary — press `j`)

The modern debugging tool for Expo apps (React Native 0.76+):

1. Start the app: `bun start:local` or `bun start:dev`
2. Press `j` in the Metro terminal to open React Native DevTools
3. Available tabs:
   - **Console** — interactive JS console connected to the app
   - **Sources** — set breakpoints, step through code
   - **Network** — inspect fetch requests and media loads
   - **Memory** — heap snapshots and memory profiling

### Expo Developer Menu (press `m`)

Press `m` in the Metro terminal to open the Developer Menu on the connected device:
- Toggle performance monitor (RAM, JS heap, Views, FPS)
- Toggle element inspector
- Open JS debugger
- Reload app

### iOS Logs

```bash
# Via Expo CLI (logs appear in Metro terminal automatically)
# Just run the app — console.log output streams to the terminal

# Via Xcode Console (native-level logs)
# Open Xcode > Devices and Simulators (Shift+Cmd+2) > Open Console

# Via macOS Console app (simulator logs)
# Open Console.app > filter by process name
```

### Android Logs

```bash
# Via Expo CLI (logs appear in Metro terminal automatically)
# Just run the app — console.log output streams to the terminal

# Via adb logcat (native-level logs, verbose)
adb logcat *:E  # Errors only
adb logcat -s ReactNativeJS  # React Native JS logs only
adb logcat -s ReactNativeJS:V *:S  # JS logs verbose, suppress everything else

# Via Android Studio Logcat
# Open Android Studio > View > Tool Windows > Logcat
# Filter by package name or "ReactNativeJS"
```

### Production Crash Logs (Device)

For production crash investigation on native platforms:
- **iOS**: Xcode Crashes Organizer (TestFlight/App Store builds)
- **Android**: Google Play Console > Crashes section
- **Both**: Sentry captures JS-level crashes — use `ops-monitor-errors` skill

## Remote Logs (CloudWatch via Serverless Framework)

Discover available log scripts from the backend `package.json` (matching `logs:*` and `logs:watch:*`).

### Prerequisites

```bash
cd "${BACKEND_DIR:-../backend-v2}"
bun run aws:signin:{env}
```

### View Recent Logs

```bash
cd "${BACKEND_DIR:-../backend-v2}"
FUNCTION_NAME={fn} bun run logs:{env}
```

### Tail Logs (follow mode)

```bash
cd "${BACKEND_DIR:-../backend-v2}"
FUNCTION_NAME={fn} bun run logs:watch:{env}
```

## Remote Logs (AWS CLI — Advanced Filtering)

For more advanced filtering, use the AWS CLI directly. Discover the AWS profile from backend `package.json` `aws:signin:*` scripts.

### Discover Log Groups

```bash
aws logs describe-log-groups \
  --profile {aws-profile} \
  --region us-east-1 \
  --query 'logGroups[].logGroupName' \
  --output text | tr '\t' '\n'
```

### Filter for Errors (last 30 minutes)

```bash
aws logs filter-log-events \
  --profile {aws-profile} \
  --region us-east-1 \
  --log-group-name "{log-group}" \
  --start-time $(date -v-30M +%s000) \
  --filter-pattern "ERROR" \
  --query 'events[].message' \
  --output text
```

### Tail Live Logs

```bash
aws logs tail "{log-group}" \
  --profile {aws-profile} \
  --region us-east-1 \
  --follow \
  --since 10m
```

## EAS Build Logs

For frontend build issues:

```bash
# List recent builds
eas build:list --limit 5

# View specific build details
eas build:view {build-id}
```

## Output Format

Report log findings as:

| Source | Timestamp | Level | Context | Message |
|--------|-----------|-------|---------|---------|
| CloudWatch | 2024-01-15T10:30:00Z | ERROR | api | Connection timeout to RDS |
| Browser | — | ERROR | console | TypeError: Cannot read property 'name' |
| Device | — | WARN | ReactNativeJS | VirtualizedList: missing keys |

Include a summary of findings: total errors, warnings, and any patterns observed.

Overview

This skill helps you locate, tail, and search application logs across local processes, browser consoles, React Native devices, and remote AWS CloudWatch. It centralizes common workflows for filtering, error hunting, and live tailing so you can quickly identify runtime issues across frontend and backend environments.

How this skill works

The tool discovers log entry points by reading backend scripts, environment files, and known project paths to find log and watch commands, function names, and Sentry DSNs. It supports capturing stdout from local services, browser console output (via Playwright or DevTools), device logs for iOS/Android, and CloudWatch access through Serverless scripts or direct AWS CLI commands. Results are reported in a consistent table format with source, timestamp, level, context, and message plus a summary of errors and patterns.

When to use it

  • Debugging runtime errors in local frontend or backend processes
  • Capturing browser console and failed network requests during UAT
  • Inspecting React Native device or simulator logs for JS/native issues
  • Tailing production function logs in CloudWatch to investigate incidents
  • Filtering recent errors across environments to triage recurring failures

Best practices

  • Set BACKEND_DIR in local settings if backend is outside the default path
  • Use logs:watch scripts or aws logs tail for live follow mode instead of re-running queries
  • Correlate Sentry DSN from .env files with CloudWatch traces when available
  • Capture browser logs programmatically with Playwright for repeatable UAT
  • Filter by error level and time window to reduce noise when searching production logs

Example use cases

  • Tail a Lambda function in staging: set FUNCTION_NAME and run logs:watch:staging
  • Reproduce a client-side crash and capture console + network failures via Playwright
  • Collect Android JS logs using adb logcat -s ReactNativeJS when a device shows UI errors
  • Run aws logs filter-log-events to extract ERROR messages from the last 30 minutes
  • Open Metro and press j/m to use React Native DevTools or the Expo Developer Menu for interactive debugging

FAQ

How do I find which functions are available to view in CloudWatch?

Read backend package.json scripts (logs:* and logs:watch:*) and extract FUNCTION_NAME from those scripts or from .env.environment files.

Can I capture browser logs automatically during tests?

Yes — use Playwright tools to navigate to the app, collect console messages, check network requests, and run custom JS to inspect client state.