Use this script and put this in the Apache Configuration file. You must have a knowledge in Apache configuration in order to understand this.
If your website has an SSL certifcate or https enabled, use <VirtualHost *:443>
. Otherwise use <VirtualHost *:80>
for http non SSL certificate website.
Example. The program script must look like this.
<VirtualHost *:443>
# For Specific File
SetEnvIf Request_URI ~*Filename1.php DisableLogging
SetEnvIf Request_URI \Filename2.php$ DisableLogging
SetEnvIf Request_URI \.(css|js|jpg|png|gif|bmp|webp|ico|mp3)$ DisableLogging
# For IP Address
SetEnvIf Remote_Addr '1.2.3.0' DisableLogging
CustomLog "/pathtofilename-access_log" combined env=!DisableLogging
</VirtualHost>
You can also visit this url for Nginix Web Serve Guide
https://www.aapanel.com/forum/d/22633-guide-to-disable-specific-file-from-logging-in-nginx-file-log