# How to get logs

You can deploy Akto on multiple platforms like AWS, k8s etc. Please follow the below guide to find logs on your respective platform.

## AWS using Auto scaling group

1. If you've deployed Akto on `AWS` using an auto scaling group, log in to AWS console and go to `EC2 dashboard`.

<figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-4430254dff6514f3d38b9f2f833c6f218586fbde%2Faws-logs-1.png?alt=media&#x26;token=30ce6fb6-a8ec-487b-90dc-b9ee1a08793e" alt=""><figcaption></figcaption></figure>

2. If you have to get `dashboard` logs, then go to `Auto scaling group` and find the `AktoDashboardAutoScalingGroup` auto scaling group. For `runtime` logs, go to `Auto scaling group` and find the `AktoAutoScalingGroup` auto scaling group.

<figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-12836148c52688775602a351a3fdbe02fcdc5820%2Faws-logs-2.png?alt=media&#x26;token=1168900f-6471-42dd-ab7e-0460575502b6" alt=""><figcaption></figcaption></figure>

3. Find the associated EC2 instance in `Instance management` tab and SSH inside that instance. To SSH inside the instance, you can refer to [this AWS guide](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-linux-inst-ssh.html).

<figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-60f2c16be1a407a386d575c2c6223a1178b0826b%2Faws-logs-3.png?alt=media&#x26;token=9a334fcc-1f0b-407e-86c2-1e70c6b3d8ad" alt=""><figcaption></figcaption></figure>

4. Login as the root user using `sudo su -` and run `docker ps` to find the running containers. For `dashboard` logs, look for `akto-api-security-dashboard` container. For `runtime` logs, check for the container with `runtime` word it.

<figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-4f377cf1c28d3e9673f322422163109aec9c862d%2Faws-logs-4.png?alt=media&#x26;token=c80e3ac0-f8ce-4ce5-bec6-8633c32b0f9e" alt=""><figcaption></figcaption></figure>

5. You can find the logs for any container using the following command `docker logs <container-id> --tail 10000` . Since there can be many logs, we are using `--tail 10000` , you can increase this number for older logs or add `-f` flag for running logs.

<figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-5ce8ee54bb09a4dea5a0c84e3cdd8801291de694%2Faws-logs-5.png?alt=media&#x26;token=06f930ef-85f6-4b50-beef-f90cc9877579" alt=""><figcaption></figcaption></figure>

## Using helm charts in kubernetes

1. Connect to your kubernetes cluster
2. Check your deployments for an `akto` deployment using `kubectl get deployments -n <namespace>`. Make sure the namespace is correct.

<figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-8e16e5dc76814e12bb7f011009668cac5e7a9628%2Fk8s-logs-1.png?alt=media&#x26;token=3fd24068-e824-44da-a0f0-109f4eb52066" alt=""><figcaption></figcaption></figure>

3. You can get the pods associated with this deployment using `kubectl get pods -n staging`.

<figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-8ca8afb4875fe49f74604aebd22304f44a3bae1b%2Fk8s-logs-2.png?alt=media&#x26;token=57959751-b920-4130-a367-708827b8e5fe" alt=""><figcaption></figcaption></figure>

4. Pick the pod you'd like to view the logs for and run the following command `kubectl logs <pod-name> -n <namespace> --tail 10`. Since there can be a good number of logs, using tail is recommended. You can also use `-f` flag for running logs.

<figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-8b685877b0bc23bde5529b504823af9780f21fc9%2Fk8s-logs-3.png?alt=media&#x26;token=ce44d2fa-36e5-42cf-80a0-de41c9a96472" alt=""><figcaption></figcaption></figure>

## Local deploy using docker

1. If you've deployed locally using docker, run a `docker ps` to check the running containers.

<figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-6e84c00fc5ceced221af660bbf99844ca01b532f%2Flocal-logs-1.png?alt=media&#x26;token=11b41101-2495-4b74-907f-161355d7fd59" alt=""><figcaption></figcaption></figure>

2. Run `docker logs <container-id> --tail 100` . Since there can be many logs, we are using `--tail 100` , you can increase this number for older logs or add `-f` flag for running logs.

<figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-71853e47776a37b6c179d679775d8756bfa8bfe6%2Flocal-logs-2.png?alt=media&#x26;token=dd120e76-3e7d-4c64-8bcf-5b575f322c52" alt=""><figcaption></figcaption></figure>
