---
layout: docs
page_title: Log agent behavior
description: >-
  You can output a Consul agent's log to a file and start the agent in the background so that Consul does not lock the active terminal window when you start a Consul agent.
---

# Log agent behavior

This page describes the process to output a log of the Consul agent's behavior.

## Overview

First, make sure your user has write permissions in the Consul data directory.

```shell-session
$ sudo chmod g+w /opt/consul/
```

Then start the Consul process. By default the Consul agent outputs logs to the open terminal. To start the agent without locking the terminal and output to a log instead, run the following command.

```shell-session
$ consul agent -config-dir=/etc/consul.d/ > /tmp/consul-server.log 2>&1 &
```
