Skip to main content
  1. Posts/

Custom Log Format in Apache

·1 min·
apache apache linux

Access Log dan Error log di Apache sangat berguna untuk bagi administrator untuk memantau aktivitas yang terjadi di situs web dan memudahkan dalam troubleshoot jika terjadi error.

Artikel ini akan membahas cara mengonfigurasi custom log agar Anda dapat dengan mudah mendapatkan informasi saat situs diakses oleh pengunjung.

Edit file konfigurasi httpd.conf lalu tambahkan baris berikut.

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b server: %v" custom1
</IfModule>

Contoh variable lain bisa Anda temukkan di Apache Module mod_log_config

Kemudian untuk menggunakan LogFormat tersebut, Anda perlu mengedit CustomLog pada konfigurasi virtualhost atau konfigurasi httpd.conf.

    CustomLog "/var/log/httpd/web1-access_log" custom1

Restart service Apache untuk menerapkan perubahan.

systemctl restart httpd

Lalu cek file access log.

# tail -f /var/log/httpd/web1-access_log
192.168.100.128 - - [17/Jun/2024:12:28:02 +0700] "GET / HTTP/1.1" 200 94006 server: web1.topan.local

Related

Install Apache dengan PHP-FPM dan Userdir
·3 mins
apache ubuntu linux php apache
How to use mod_rewrite in Apache
·2 mins
apache apache
Monitor Apache Web Server with mod_status
·1 min
apache apache
Enable Google PageSpeed Module
·2 mins
linux linux apache nginx
Enable Brotli Compression
·2 mins
linux apache nginx linux
Cara Menginstal ModSecurity di Apache
·2 mins
apache apache modsec