Configure HTTP server log files

Maria Long is a RHEL Sysadmin at Microsoft:

  • Her RHEL Server: Maria_RHEL_Server_1975
  • Her username: maria.long
  • Her professional preference: RHEL Syadmins should NEVER run RHEL commands as root
  • Her certifications: Comptia Linux+, LPIC 1, 2 and 3, LFCS
  • Her task: Configure HTTP server log files

Maria's manager has tasked her with teaching a class of 24 LFCS candidates how to configure HTTP server log files. Please generate and explain the commands that Maria needs to demonstrate to teach this LFCS exam objective.

Certainly! Here are the commands that Maria Long can demonstrate to teach the LFCS candidates how to configure HTTP server log files on a RHEL server:

  1. View the current configuration file for the HTTP server:

    • cat /etc/httpd/conf/httpd.conf
  2. Edit the main configuration file for the HTTP server:
    • sudo vi /etc/httpd/conf/httpd.conf
  3. Enable or disable logging for the HTTP server: In the configuration file, search for the following directive and modify it as needed:
    • # Enable logging
      CustomLog logs/access_log combined

      # Disable logging
      #CustomLog logs/access_log combined
  4. Configure log file format: In the configuration file, search for the following directive and modify it as needed:
    • LogFormat "%h %l %u %t \"%r\" %>s %b" common
    • Here, %h, %l, %u, %t, %r, %>s, and %b represent various fields like IP address, user, timestamp, request, status code, and response size, respectively. Modify the format based on your requirements.
  5. Define log file location: In the configuration file, search for the following directive and modify it as needed:
    • # Define log file location
      ErrorLog /var/log/httpd/error_log
  6. Save the configuration file and exit the editor.

  7. Restart the HTTP server for changes to take effect:

    • sudo systemctl restart httpd

By demonstrating these commands, Maria can guide the LFCS candidates in understanding and configuring the HTTP server log files on a RHEL server. She should emphasize the importance of running RHEL commands as a regular user and only using administrative privileges when necessary to maintain security and best practices.

You should also read:

/etc/httpd/conf.d/

Maria needs to prepare a 5 paragraph overview of /etc/httpd/conf.d/. She is a RHEL Manager at IBM, and she needs to write these…