> ## Documentation Index
> Fetch the complete documentation index at: https://docs.octopipe.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Logs

# `octopipe logs` Command Reference

The `octopipe logs` command provides real-time insights into the execution of your pipelines by streaming log data to your terminal. It is a critical tool for monitoring, debugging, and verifying that your pipelines are running as expected.

## Purpose

* **Real-Time Monitoring:**
  Stream live logs to view pipeline execution details.
* **Debugging:**
  Filter and analyze logs to identify errors or performance bottlenecks.
* **Historical Analysis:**
  Retrieve past logs for auditing or troubleshooting purposes.

## Usage

```bash theme={null}
octopipe logs [pipeline_name] [options]
```

**Options**

•	`--tail <number>`

**Description:** Displays the last N lines of logs.

**Example:** --tail 100

•	--follow

**Description:** Streams logs in real time, similar to the Unix tail -f command.

•	`--since <duration>`

**Description:** Shows logs since a specific time period (e.g., 1h for one hour, 30m for 30 minutes).

**Example:** --since 1h

•	`--grep <pattern>`

**Description:** Filters log output to only include lines that match a specified pattern.

**Example:** --grep "ERROR"

•	`--level <log_level>`

**Description:** Filters logs by level (e.g., info, warn, error).

**Example:** --level error

**Detailed Behavior**

•	**Real-Time Streaming:**

When the --follow option is enabled, logs are continuously streamed to your terminal until you cancel the command.

•	**Filtering:**

The --grep and --level options allow you to focus on specific log entries, reducing noise and aiding in quick troubleshooting.

•	**Tail Option:**

The --tail option is useful for reviewing the most recent log entries to quickly identify recent events or errors.

**Examples**

**Example 1: Follow Logs for a Pipeline**

```
octopipe logs daily_sales --follow
```

**Example 2: Tail the Last 50 Lines of Logs**

```
octopipe logs daily_sales --tail 50
```

**Example 3: Filter Logs for Errors**

```
octopipe logs daily_sales --grep "ERROR" --level error
```

**Example 4: Show Logs Since the Last Hour**

```
octopipe logs daily_sales --since 1h
```

**Best Practices**

•	**Real-Time Monitoring:**

Use the follow option during initial deployment to catch any startup issues early.

•	**Focused Debugging:**

Apply filters to isolate errors or warnings, making it easier to pinpoint issues.

•	**Regular Checks:**

Periodically review logs even when pipelines are running smoothly to identify potential optimizations.

**Troubleshooting**

•	**No Logs Displayed:**

Ensure that the pipeline is running and that log generation is enabled in the configuration.

•	**Overwhelming Output:**

Use filtering options (--grep, --level) to reduce output to manageable levels.

•	**Stale Logs:**

If the logs command returns outdated information, check the pipeline status to ensure it’s actively processing data.

**Conclusion**

The octopipe logs command is indispensable for maintaining visibility into your pipeline operations. With its powerful filtering and real-time streaming capabilities, you can monitor, debug, and optimize your pipelines effectively.
