Windows Apache Logs

XAMPP on Windows

  1. start your windows VM

XAMPP is a free, cross-platform software package that bundles together an Apache web server, MariaDB (a database), and interpreters for PHP and Perl, allowing users to create a local development environment to test and debug web applications without needing an internet connection or a remote server.

  1. Do the following options for set up:

    1. UAC warning = OK

    2. Select compnents: Apache, MySQL, PHP, phpMyAdmin only

  2. Start XAMPP Control Panel

  1. Start MySQL and Apache

  1. Open a browser and type http://localhost

    1. You should see the XAMPP default web page!

  2. Navigate to the folder c:\xampp\htdocs (default files of XAMPP are here)

  3. Delete all the files!

  1. create a file called index.html

    1. Check the option file name extensoins on file explorer

  1. Input the following in index.html

    1. make html files for each of your 3 pages

  1. Use your IP address or localhost (mine is 10.0.17.37 ) to access the website and you should see what you created in your index.html file.

  1. Create some 404 errors by trying to access pages that don't exist

Inspecting Apache Logs

  1. Start your Windows PowerShell ISE as Administrator

  2. Navigate to the apache logs folder of your XAMPP from blue part of your PowerShell ISE:

List all apache logs of XAMPP:

Unsolved:

Solved:

List the last 5 logs of XAMPP

Unsolved:

Solved:

Display only logs that contain 404 (Not Found) or 400 (Bad Request)

Unsolved:

Solved:

circle-info

You will see above that there are spaces between the quotes and the status code. This indicates the regex pattern "\b(404|400)\b" to exactly match 404 and 400 status codes without catching other 40x errors like 401, 403, etc.

Display only logs that does NOT contain 200 (OK)

Unsolved:

Solved:

From every file with .log extension in the directory, only get logs that contain the word 'error'

Unsolved:

Solved:

Display only IP addresses for 404 (Not Found) records

Unsolved:

Solved:

Count $ips from Number 8

Unsolved:

Solved:

Last updated