This page presents troubleshooting techniques when the
Extensible Service Proxy (ESP) is deployed on a Compute Engine virtual
machine (VM).

## Viewing logs on the VM instance

You can troubleshoot problems by looking at the Endpoints
Runtime log on the VM instance.

To view the log:

1. Use `ssh` to connect to your virtual machine:

   ```
   gcloud config set project YOUR_PROJECT_ID

   gcloud compute ssh INSTANCE_NAME
   ```

   Replace `YOUR_PROJECT_ID` and
   `INSTANCE_NAME` with your Google Cloud
   project ID and virtual machine instance name, respectively.
2. View the `nginx` error log:

   If you are running endpoints-runtime on a raw VM:

       tail -f /var/log/nginx/error.log

   If you are running `endpoints-runtime` within Docker:

   ```
   docker ps

   docker logs CONTAINER_NAME
   ```

   Replace `CONTAINER_NAME` with the name of your
   container.

## Displaying ESP status

To display ESP status:

1. Use `ssh` to connect to your your virtual machine:

   ```
   gcloud config set project YOUR_PROJECT_ID

   gcloud compute ssh INSTANCE_NAME
   ```

   Replace `YOUR_PROJECT_ID` and
   `INSTANCE_NAME` with your
   Google Cloud project ID and virtual machine instance name, respectively.
2. Retrieve the name of the ESP container (typically
   the container name is `esp`):

       docker ps

3. Get a bash shell in the container:

   ```
   docker exec -it ESP_CONTAINER_NAME /bin/bash
   ```

   Replace `ESP_CONTAINER_NAME` with the name of the
   ESP container from the previous step.
4. Install [`curl`](https://curl.haxx.se/download.html).

5. Enter the following:

       curl http://localhost:8090/endpoints_status

### Getting the service configuration ID

If you set `rollout_strategy` to `managed` when you started ESP,
and you need to find the configuration ID that an instance of
ESP is using, near the end of the output from the
`curl http://localhost:8090/endpoints_status` command, the output is similar to
the following:

          "serviceConfigRollouts": {
              "rolloutId": "2017-08-09r27",
              "percentages": {
                   "2017-08-09r26": "100"
              }
          }

The value in the `rolloutId` is the service configuration ID that
ESP is using. This configuration ID should match the latest deployed configuration.
You can view the deployment history on the **Endpoints** \> **Services** page in the
Google Cloud console and view changes made to the service configuration. See
[Comparing configuration files](https://docs.cloud.google.com/endpoints/docs/grpc/config-file-compare.md.txt).