# Guidelines for Exporting Logs

## **Admin Portal**

* Log in to the admin portal. Navigate to **App Container Logs** under the **Insights** section in the left blade.
* Select the required Application/Container logs using the checkboxes, then click **Export** to download them.

![Export app container log files](https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2FpjW68M1EgXMTK81bFCOa%2F3.jpeg?alt=media)

## **To retrieve additional logs from various Azure services:**

### 1. App Service

#### Log Stream:

* In the App Service blade, under **Monitoring**, select **Log stream**.
* This opens a live log streaming session for your application.

![Log stream](https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2Fh791VI4VBxBPtoXjkr0M%2F4.jpeg?alt=media)

#### **Deployment Center Logs:**

{% hint style="warning" %}

### Note: App Service does not persist deployment logs after restarts or after a certain retention period.

{% endhint %}

* From the left blade, select **Deployment Center**.
* Click on **Logs**.
* These logs include build steps, deployment actions, and any errors or warnings.
* If a deployment is in progress, logs will stream live in the Logs pane.

![Deployment center logs](https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2Fqm5OGOGKEEEFuuJOtIhZ%2F6.jpeg?alt=media)

* Click the **Download** toggle and then click on **Download the .zip file** to export the logs.

![Download logs](https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2Fpk8yx0U7ySdOW9F7qWlr%2F7.jpeg?alt=media)

### 2. Azure Kubernetes Services

#### **CLI**:

* From the AKS **Overview** tab, select **Connect**, then use **Open Cloud Shell** to set the subscription and configure the cluster credentials.

<figure><img src="https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2FiYyVGbxZ945DvP5Zp5tN%2F9.jpeg?alt=media" alt=""><figcaption><p>Open Cloud Shell</p></figcaption></figure>

#### In Cloud Shell, use the following commands to view pod logs:

* **List all pods in a namespace:**

`kubectl get pods -n <namespace>`

* **View logs of a specific pod:**

`kubectl logs <pod-name> -n <namespace>`

* **Stream logs in real-time:**

`kubectl logs -f <pod-name> -n <namespace>`

* **Export logs of specific pod**

`kubectl logs <pod-name> -n <namespace> > podlogs.txt`

### 3. Container Instance

#### Container Logs:

* On the left blade, click **Containers**.
* Select the specific container you want to inspect.
* Click on **Logs**; this shows the individual container’s logs.

![Container logs](https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2FDGJbq4LBz6klRMWBmyCt%2F11.jpeg?alt=media)
