DirectAdmin Apache access/error logs location for user

wdc

Verified User
Joined
Dec 8, 2013
Messages
64
does not list any location i would be able to access as a regular DirectAdmin user via SSH, FTP.
If not available for user, then make the log files available please so user can better control the account via SSH filtering these logs and such.
 
The user will be able to see and browse the logfiles via Directadmin via the statistics and logs page.

Physically they reside here:
/home/user/domains/domain.com/logs
 
Thanks, i can see the files, but it is not readable as it is some weird numbered archives:
Aug-2021.forum.tar.gz
Aug-2021.forum.tar.gz.1
Aug-2021.forum.tar.gz.2
Aug-2021.forum.tar.gz.3
Aug-2021.forum.tar.gz.4
DirectAdmin web UI is extracting them on background or these files are just duplicity as DA is using other, uncompressed log files?
Any idea how to properly extract these numbered files via command line?
 
Those are not weird numbered archives.
You can read them via the DA web UI, so yes it's extracting them in the background.

If you want to view them via commandline, you could install Midnight Commander (yum install mc) or extract them.
However, before you extract them, copy them to another place just to be sure, because DA uses them.

You can ftp them to a windows pc and open them with Winrar too.

Extrating in linux works like:
tar -zxvf Aug-2021.forum.tar.gz
same for the others. They are backups so they will contain the same logs but from older dates.
 
  • Like
Reactions: wdc
Extrating in linux works like:
tar -zxvf Aug-2021.forum.tar.gz
i have tried this and it fails:
-rw-r--r-- apache/myusername 6029 2021-08-20 08:25 mydomain.com.forum.log
tar: mydomain.com.forum.log: Cannot open: Permission denied
but when i went into my home directory (command "cd") then it worked:
cd;tar -zxvvvvf ~/domains/mydomain.com/logs/Aug-2021.forum.tar.gz

i am trying to make an ultimate command that will extract all the logs for current month, find lines containing phrases and delete logs, so far i have this:
cd;tar -xzvvvvf ~/domains/*/logs/$(date +%b)-$(date +%Y)*.tar.gz;grep POST *.log|grep ".php"|grep -Ev "wp_cron|xmlrpc.php|wp-comments-post.php";rm -f *.log;cd -
(should list POST requests to a .php files), but it does not work when there is an asterisk in the archive name (*.tar.gz), saying "tar: /home/myusername/domains/mydomain.com/logs/Aug-2021.subdomainXY.tar.gz: Not found in archive" i have to manually define subdomain instead of asterisk or:
cd;for dn in subdomain1 subdomain2 subdomain3; do tar -xzf ~/domains/*/logs/$(date +%b)-$(date +%Y).$dn.tar.gz;grep POST *.log|grep ".php"|grep -Ev "wp_cron|xmlrpc.php|wp-comments-post.php|posting.php|ucp.php"; done; rm -f *.log;cd -
yet that does not work for main domain. Idea how to overcome that in an one-liner ideally so it extract all available logs?
 
Last edited:
but when i went into my home directory (command "cd") then it worked:
Yes it's logic that you use that command in the directory where the file is present. That is not different than in Windows.
Should also have worked as root with tar -xzvf /home/user/domains/domain.com/logs/Aug-2021.forum.tar.gz
but then it would be extracted in the current directory you're presently in and you have to have writing rights in there. If I'm not mistaken, didn't do it like that for a long time.

As for the other questions, I wouldn't know. I don't do any scripting. We don't use it this way because users can view the logs via the DA panel or download them and then use Winrar or the free 7zip to easily unpack the files when needed.
So user already has 2 options.

Unpack logfiles for the domains are already present in /var/log/httpd/domains/userdomain.com.log and userdomain.error.log so admin can look there easily.

But I'm sure somebody else can help you with that scripting part.
 
Back
Top