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

# Logs

For troubleshooting, it may be helpful to download the log files from the PPL controller. This section explains different
methods for downloading these log files. The available methods include using the NATS application, the SCP command in the
terminal, or FileZilla. The first method is preferred as it is the easiest.

### Via NATS Application (Preferred)

In the examples folder, there is an application called `download-logs.py` that retrieves log files from the PPL controller
and stores them in a folder called `logs` on your local machine within the current directory. Follow the steps below:

<Steps>
  <Step title="Open Visual Studio Code">
    Open Visual Studio Code.
  </Step>

  <Step title="Open repository">
    Open the folder containing the `dep-ppl-app` repository.
  </Step>

  <Step title="Open a new terminal">
    Open a new terminal by clicking on **Terminal** in the top menu bar and selecting **New Terminal**. A terminal window
    will open at the bottom of your screen.
  </Step>

  <Step title="Run the command">
    Run the following command in the terminal:

    ```bash theme={null}
    python download-logs.py
    ```

    The files will be stored in the `logs` folder on your local machine and current directory.
  </Step>
</Steps>

### Via SCP Command

<Steps>
  <Step title="Open a Terminal">
    On your local machine, open a terminal:

    * **Windows**: use Command Prompt, PowerShell, or a terminal emulator like Git Bash.
    * **MacOS or Linux**: open the default Terminal application.
    * Alternatively, you can use the terminal in **VS Code**.
  </Step>

  <Step title="Use the SCP Command">
    To download a specific log file from the remote controller, use the `scp` command:

    ```bash theme={null}
    scp admin@<ipAddress>:/opt/plcnext/appshome/data/60002172000969/log/<filename> /local/path/
    ```

    * Replace `ipAddress` with the IP address of the controller.
    * Replace `filename` with the actual name of the log file you want to download
      * Filenames include: *ppl.log*, *pplpy.log*, *livebit.log*, *natsdriver.log.*
    * Replace `/local/path/` with the directory path on your local machine where you want to save the log file.

    For example, if your controller is at IP `192.168.1.10`, you want to download the `pplpy.log` file, and you want to save
    it to your Desktop, the command would look like this:

    ```bash theme={null}
    scp admin@192.168.1.10:/opt/plcnext/appshome/data/60002172000969/log/pplpy.log ~/Desktop/
    ```
  </Step>

  <Step title="Enter the Password">
    After running the command, you’ll be prompted to enter the password for the `admin` user. Once you provide the correct
    password, the log file will be copied to your specified local directory.
  </Step>
</Steps>

<Tip>
  Here are some useful tips for downloading log files using the SCP command:

  <Expandable title="Download Multiple Files">
    If you want to download all the log files in the `/opt/plcnext/appshome/data/60002172000969/log` directory, you can use the following command:

    ```bash theme={null}
    scp admin@192.168.1.10:/opt/plcnext/appshome/data/60002172000969/log/* /local/path/
    ```

    This command will copy all files in the `/opt/plcnext/appshome/data/60002172000969/log` directory to your local machine.
  </Expandable>

  <Expandable title="Download Files to Current Directory">
    If you want to download the log files to the current directory on your local machine, you can use the following command:

    ```bash theme={null}
    scp admin@192.168.1.10:/opt/plcnext/appshome/data/60002172000969/log/ppl.log .
    ```
  </Expandable>
</Tip>

### Via FileZilla

<Steps>
  <Step title="Download and Install FileZilla">
    * **Go to the Website**: Open your browser and visit [FileZilla official website](https://filezilla-project.org/).
    * **Download FileZilla**: Click on the **Download FileZilla Client** button and choose the appropriate version for your
      operating system (Windows, macOS, Linux).
    * **Install**: Run the downloaded file and follow the installation prompts.
  </Step>

  <Step title="Launch FileZilla">
    * After installation, open FileZilla from your Start Menu or Applications folder.
  </Step>

  <Step title="Connect to the Controller">
    * **Open the FileZilla Interface:** You’ll see fields at the top labeled `Host`, `Username`, `Password`, and `Port`.
    * **Enter Connection Details:**
      * **Host:** Enter the IP address of the controller (e.g., `192.168.1.10`).
      * **Username:** Enter the username for your controller (`admin`).
      * **Password:** Enter the admin password for your controller.
      * **Port:** Enter `22` for SFTP (secure FTP).
    * **Click Quickconnect:** Connect to the controller.
  </Step>

  <Step title="Navigate to the Logs Directory">
    * **Remote Site:** In the *Remote site* panel (right side), navigate to the `/opt/plcnext/appshome/data/60002172000969/log` directory where the logs are stored.
    * **Select Logs:** Click on the `/opt/plcnext/appshome/data/60002172000969/log/` folder to open it and view the log files.
  </Step>

  <Step title="Download the Logs">
    * **Select Files:** Click on the log files you want to download (you can select multiple files by
      holding the `Ctrl` (Windows) or `Cmd` (macOS) key).
    * **Download Files:** Right-click on the selected files and choose **Download** or drag them to the *Local site* panel.
    * **Monitor Download:** Check the download progress at the bottom of the FileZilla interface.
  </Step>

  <Step title="Disconnect from the Controller">
    * Once the download is complete, you can disconnect by clicking on the **Disconnect** button (red "X" icon) in the toolbar or simply close the FileZilla application.
  </Step>
</Steps>

If you have questions about possible errors in the log files or would like the PPL Support team to review them, feel free to email your request to [pplsupport@directenergypartners.com](mailto:pplsupport@directenergypartners.com), and be sure to include the log files.
