SOLVED EasyApache master/custom/global access log

luis_h

Registered
Sep 2, 2015
4
3
3
Brasil
cPanel Access Level
Root Administrator
Hello

I have tried to reply on this thread but I couldn't because it's too old.
I'm trying to create a "master" apache access log file, and also keep individual log files.

Following the instructions, I could set up a "master access log file" and it works ok. But unfortunately, the individual log files are not being generated anymore.

I have read some mention about this here (by @cPanelMichael ) but I could not understand what should I do to have all logs working.

I'm using EasyApache4 and piped logs.

The code that I have updated at /var/cpanel/templates/apache2/vhost.local

Code:
...........

LogFormat "%V %a %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"" vcommon
CustomLog /var/log/httpd/vhost-access_log vcommon

</VirtualHost>
and then executed:

/usr/local/cpanel/scripts/rebuildhttpdconf
/scripts/restartsrv_httpd


Any suggestions?

Thanks

Sorry, i forget the link on the mention:

I have read some mention about this here (by @cPanelMichael ) but I could not understand what should I do to have all logs working.
 

luis_h

Registered
Sep 2, 2015
4
3
3
Brasil
cPanel Access Level
Root Administrator
Thank you @cPanelMichael

After some tests, here is the entire configuration that I have used to make this work:

Code:
cp -a /var/cpanel/templates/apache2_4/ea4_main.default /var/cpanel/templates/apache2_4/ea4_main.local
Edit /var/cpanel/templates/apache2_4/ea4_main.local

I have inserted the code, in the section <IfModule mod_log_config.c>
Code:
LogFormat "%V %a %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"" mycustom
CustomLog /etc/apache2/logs/combined_apache_accesslog mycustom


Just on the end of the section, above the existing lines:

Code:
CustomLog "|/usr/local/cpanel/bin/splitlogs --dir=[% paths.dir_domlogs %] --main=[% wildcard_safe(servername) %] --mainout=[% paths.file_access_log %][% splitlogsextra %]"$
</IfModule>
After, rebuild and restart apache.

And was just this, only two lines of code. I did not need to use the file: /var/cpanel/templates/apache2/vhost.local
I works for both, non-ssl and ssl access.
 
  • Like
Reactions: cPanelMichael

luis_h

Registered
Sep 2, 2015
4
3
3
Brasil
cPanel Access Level
Root Administrator
I forgot to mention, that I have activated the log rotation, using the WHM gui, at
Home »Service Configuration »Apache Configuration »Log Rotation

WHM automatically recognized the log file at the logs list.
 
  • Like
Reactions: cPanelMichael