Commands.page Logo

How to Configure aria2 Log File Path on Ubuntu Linux

This guide explains how to configure the aria2 download utility to save log files to a specific directory on Ubuntu. Whether you prefer using command-line arguments for single sessions or a persistent configuration file for permanent settings, you will learn the exact steps to enable logging and define the output path. Proper logging helps troubleshoot download errors and monitor activity effectively without cluttering your terminal.

Using Command Line Arguments

For temporary logging during a specific download session, you can specify the log file path directly in the terminal command. Use the --log option followed by the absolute path where you want the log file saved. You should also set the log level using --log-level.

aria2c --log=/var/log/aria2/aria2.log --log-level=warn https://example.com/file.zip

Ensure the directory exists before running the command. If the directory /var/log/aria2/ does not exist, create it using sudo mkdir -p /var/log/aria2/ and adjust permissions if necessary.

Using the Configuration File

To make logging permanent for all aria2 sessions, modify the aria2 configuration file. This file is typically located at ~/.config/aria2/aria2.conf or /etc/aria2/aria2.conf. If the file does not exist, create it in your home configuration directory.

  1. Open the configuration file in a text editor:

    nano ~/.config/aria2/aria2.conf
  2. Add or modify the following lines to set the log path and level:

    log=/var/log/aria2/aria2.log
    log-level=warn
  3. Save the file and exit the editor.

Setting Directory Permissions

Aria2 must have write permissions for the specified log directory. If you choose a system directory like /var/log/aria2/, you need to adjust ownership so your user can write to it without using sudo for every download.

sudo mkdir -p /var/log/aria2/
sudo chown $USER:$USER /var/log/aria2/

Verifying the Configuration

Run a test download to confirm that the log file is being generated. Check the specified path for the new log file.

aria2c https://example.com/test-file.zip
cat /var/log/aria2/aria2.log

If the file contains download activity records, the configuration is successful. Adjust the log-level to info or debug if you require more detailed output for troubleshooting.