On Ubuntu, Apache normally writes requests to /var/log/apache2/access.log and server errors to /var/log/apache2/error.log. Configure per-site destinations with CustomLog and ErrorLog, rotate those files with logrotate, and reload Apache in the rotation’s postrotate action. Without that reload, Apache can continue writing to the renamed file through its existing open file handle.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
Where Apache logs are stored on Ubuntu
A stock Ubuntu Apache installation uses two principal log files:
As an Amazon Associate I earn from qualifying purchases.
| Log | Default path | What it contains | Per-virtual-host directive |
|---|---|---|---|
| Transfer/access log | /var/log/apache2/access.log |
HTTP requests handled by Apache, including the client request and response activity recorded by the selected log format. | CustomLog |
| Error log | /var/log/apache2/error.log |
Server errors and diagnostic messages. | ErrorLog |
Ubuntu’s packaged configuration also exposes the APACHE_LOG_DIR variable, which points to the Apache log directory in the standard layout. Using ${APACHE_LOG_DIR} in a virtual-host file keeps the path aligned with that layout while still allowing each site to have separate files.
The global defaults apply when a virtual host does not specify its own destinations. A virtual host can replace either destination independently, so a site may have a custom access log while continuing to use the global error log, or define both custom files.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
How CustomLog and ErrorLog work
CustomLog records requests
CustomLog selects the file or logging process for HTTP request records. Its usual form contains a destination followed by a log-format name. The combined format is commonly used because it records the standard request fields plus useful client and referrer information. The format itself controls which fields are written; changing the destination does not change the fields.
ErrorLog records server diagnostics
ErrorLog selects where Apache writes warnings, startup diagnostics, module errors and other server messages. It does not replace request logging. If you configure only ErrorLog, requests still go to the applicable CustomLog destination; if you configure only CustomLog, errors still go to the applicable error log.
Piped logging
When the value begins with a pipe character (|), Apache starts a logging process and sends log records to it instead of opening a normal file directly. This is the mechanism used by Apache’s rotatelogs utility. Piped logging changes the process and failure model, so choose it deliberately rather than mixing it with ordinary file rotation for the same destination.
Configure separate logs for a virtual host
Put the logging directives in the virtual-host definition that serves the site. For example, create or edit /etc/apache2/sites-available/example.conf:
<VirtualHost *:80>
ServerName example.com
CustomLog ${APACHE_LOG_DIR}/example_access.log combined
ErrorLog ${APACHE_LOG_DIR}/example_error.log
</VirtualHost>
The two files in this example are independent of the default access.log and error.log. The names are arbitrary; use names that make the site and purpose obvious, especially on a host serving many domains.
Enable, validate and reload the site
-
Enable the virtual-host file if it is not already enabled:
Recommended Free Tools
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.sudo a2ensite example.conf -
Check the complete Apache configuration before changing the running service:
sudo apache2ctl configtestA successful check reports
Syntax OK. Treat any error as a stop condition; fix the named file and line before reloading.Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
-
Apply the configuration without stopping active connections:
sudo systemctl reload apache2 -
Watch both new files while making a request:
sudo tail -f /var/log/apache2/example_access.log /var/log/apache2/example_error.log
Use the hostname that resolves to this virtual host when testing. A request sent to a different host name, address or port can be handled by another virtual host and therefore appear in another log.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsCheck that the configured files are receiving the expected records
Before adding rotation, establish that the destinations and virtual-host selection are correct. Keep a terminal running with tail -f, then issue a request from another terminal:
curl -I http://example.com/
The access log should receive a new request line. A normal response does not necessarily produce an error-log entry, so an unchanged error log is not by itself a problem. To investigate an error, reproduce the failing request and watch the error file at the same time.
If neither file changes, check the following in order:
- Confirm that the site is enabled and that
apache2ctl configtestsucceeds. - Confirm that the request’s host name matches the
ServerNameor another name served by the intended virtual host. - Check that the destination directory exists and that Apache can open the files.
- Inspect the main error log for a message about an invalid directive, an unavailable path or a permission failure.
Configure automatic rotation with logrotate
Ubuntu’s normal external rotation mechanism is logrotate. A policy file under /etc/logrotate.d/ defines when Apache logs are renamed, whether older files are compressed, how many generations remain and what action Apache must take afterward.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Create or edit a policy such as /etc/logrotate.d/apache2:
/var/log/apache2/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
sharedscripts
postrotate
systemctl reload apache2 > /dev/null 2>&1 || true
endscript
}
This example is a starting policy, not a universal retention recommendation. It evaluates the matching logs daily, keeps 14 rotated generations, compresses older generations, skips compression for the most recently rotated file, ignores files that do not exist, and avoids creating an empty archive. The wildcard includes custom virtual-host files stored in the same directory, so review the match if some logs require a different policy.
Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
What each important directive does
| Directive | Effect | Operational consideration |
|---|---|---|
daily |
Checks the policy on a daily schedule. | weekly, monthly and size-based policies are also possible when they better match traffic and storage limits. |
rotate 14 |
Keeps 14 rotated generations before older ones are removed. | Set the count from disk capacity, traffic, incident-response needs and legal retention requirements. |
compress |
Compresses older rotated files. | Compression saves space but adds decompression work when reading archives. |
delaycompress |
Leaves the newest rotated file uncompressed until the next rotation. | This can make immediate inspection easier while still compressing older history. |
missingok |
Does not treat an absent matching file as an error. | Useful when a virtual host has not generated a log yet or a site is temporarily disabled. |
notifempty |
Skips rotation when a file is empty. | Prevents empty archives for inactive sites. |
sharedscripts |
Runs the block’s post-rotation script once rather than once per matched file. | One Apache reload is normally sufficient for all files in this block. |
postrotate … endscript |
Runs commands after the files have been renamed. | Use it to make Apache reopen its logs. |
The sample’s || true prevents a failed reload from causing the logrotate command itself to be reported as failed. That convenience can hide an operational problem, so check Apache’s service status and logs if a reload error is possible in your environment.
Choose frequency and retention deliberately
Rotation frequency is a capacity and response decision, not simply a default to copy. A busy server may need size-based rotation so a single day’s file cannot consume the disk. A lightly used server may retain useful history with weekly or monthly checks. Keep enough uncompressed or readily accessible history for routine diagnosis, and retain compressed archives only as long as your incident-response and legal requirements justify.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Do not copy rotate 14 blindly. Fourteen daily generations represent a different time window from fourteen weekly generations, and neither value says how much disk space the actual traffic will consume.
Test and force a rotation safely
Dry-run the complete configuration
Use logrotate’s debug mode to inspect decisions without changing files:
sudo logrotate --debug /etc/logrotate.conf
The debug option makes no changes. Review the output for the Apache policy, matched paths and any syntax or permission warnings before performing a real rotation.
Force one intentional rotation
To exercise the policy immediately, even when logrotate does not consider a rotation due, run:
sudo logrotate --force /etc/logrotate.conf
The --force option is useful for validating a new policy or recovering from an operational event, but it can create an extra archive and compression cycle. Use it intentionally rather than as a routine schedule.
Verify the post-rotation state
After a real rotation, generate a fresh request and inspect both the directory and active file:
Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
sudo logrotate --force /etc/logrotate.conf
curl -I http://example.com/
sudo ls -lh /var/log/apache2/
sudo tail -n 5 /var/log/apache2/example_access.log
The directory should show the newly rotated generations, and the request made after rotation should appear in the new active file. The old file should stop growing once Apache has reopened the destination.
Why the reload in postrotate is essential
External rotation normally renames the active file and creates a new path. On Unix-like systems, renaming a file does not invalidate a process’s open file descriptor. Apache can therefore continue writing to the old inode even though the pathname now points to a new file. Disk usage rises in the renamed archive while the new active file remains empty or receives no records.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Apache’s logging documentation states: “Your logrotate configuration’s postrotate script should include this (or the equivalent systemctl reload command).” The reload tells Apache to reopen its configured log destinations. It applies the new file descriptors without the disruption of a full stop and start.
For that reason, a policy that renames and compresses files but omits the reload is incomplete. If a reload fails, investigate it immediately; otherwise the apparent rotation can conceal continued writes to an old handle.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Using Apache’s rotatelogs instead
rotatelogs is an Apache-managed alternative that works through piped logging. It can rotate by elapsed time or by file size. For example:
CustomLog "|/usr/bin/rotatelogs /var/log/apache2/example_access.log 86400" combined
ErrorLog "|/usr/bin/rotatelogs /var/log/apache2/example_error.log 5M"
The first line requests rotation on an 86,400-second interval; the second uses a 5-megabyte threshold. Apache’s documentation also describes time-based naming at local midnight. The exact naming and threshold should match how operators search, archive and monitor the files.
With piped logging, Apache writes to the rotatelogs process rather than directly managing a regular file. Verify that the executable path exists, the service can write the destination directory and the resulting filenames are included in monitoring and retention procedures.
Choose one rotation owner for each log
| Consideration | logrotate |
rotatelogs |
|---|---|---|
| Where rotation is controlled | Host-level policy in /etc/logrotate.d/. |
Apache’s piped logging process. |
| Triggers | Scheduled checks and optional size-based policies. | Elapsed time or file-size thresholds supplied to the process. |
| Compression and retention | Provides compression, generation counts and removal in one policy. | Handles rotation; host-level retention and compression need separate consideration. |
| Reload behavior | Requires a reload in postrotate after external renaming. |
Does not use the same external-rename workflow because logging is piped. |
| Best fit | Hosts that standardize permissions, compression, retention and service reloads across many daemons. | Deployments that prefer Apache-managed piped logging and simple time or size thresholds. |
This is an operational choice rather than a requirement to use both. Do not point an external rotation policy at a file that is already being rotated by rotatelogs unless you have a specific, tested reason; two independent rotators can rename, compress or delete files unexpectedly.
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
Troubleshoot common failures
Apache is still writing to the old rotated file
This almost always indicates that Apache did not reopen its logs. Confirm that the rotation block contains a working postrotate reload, then check the service and run a controlled rotation. After generating a request, compare the modification times and sizes of the new active file and the renamed archive. If the reload command failed, fix the configuration or service problem before relying on the next scheduled run.
No custom log file is created
First validate the configuration and confirm the virtual host is enabled. Then make a request with the correct host name. If Apache cannot open the destination, its error output normally identifies the path or permission problem. A typo in ${APACHE_LOG_DIR}, a missing directory or an inaccessible custom directory can all prevent the expected file from appearing.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallRequests appear in a different log
Apache chooses a virtual host from the request’s address, port and host header. If the test request matches another site, its CustomLog destination is the one that receives the record. Check the enabled site definitions and test with the exact host name configured for the intended site.
Rotation reports permission errors
Inspect ownership and mode on the log directory, active files and any custom directory. The rotation process must be able to rename and create files, while Apache must be able to reopen and append to the new destination. If you add a create directive, specify ownership and mode that permit Apache to write without granting unnecessary access.
Compression or retention does not look as expected
delaycompress intentionally leaves the newest archive uncompressed, so compression may not be visible until the next cycle. Also check whether the policy was actually due; a normal invocation does not rotate every file on every run. Use --debug to see the decision without changing state, and reserve --force for deliberate tests or recovery.
The configuration test fails after editing a site
Do not reload a configuration that fails apache2ctl configtest. Read the reported file and line, correct directive spelling, quoting, paths or virtual-host syntax, then run the test again. A successful test confirms syntax, not that the directory permissions or request routing are correct, so perform a live request afterward.
Free tools Windows power users keep installed
One-click scans. No signup required.
Security and privacy controls
Restrict write access to Apache’s log directories to the service account and administrators. Apache documentation warns that broad write access to its log directory can have serious security consequences: an attacker who can alter or replace log destinations may hide activity or influence what the server opens.
Review the fields selected by each log format before enabling additional request data. Do not log passwords, authorization headers, session tokens or personal data unless there is a documented requirement, an access-control plan and a retention period that covers the resulting risk. Access to compressed archives deserves the same protection as access to active logs.
After changing a custom directory or adding create, verify ownership and mode after both an ordinary and a forced rotation. Check that administrators can investigate the archives, Apache can continue writing, and unrelated users cannot modify them.
A practical operating pattern
For most Ubuntu hosts, use ordinary file logging in each virtual host, keep the files under the standard Apache log directory, and manage rotation centrally with a policy in /etc/logrotate.d/. Validate the policy in debug mode, perform one controlled rotation, generate a request, and confirm that the new active file receives it. Keep the reload in postrotate so the pathname and Apache’s open handle stay synchronized.
Use rotatelogs when Apache-managed piped logging and a straightforward elapsed-time or size threshold fit the deployment better than host-level policy. Whichever method you choose, document the destination, trigger, retention, permissions and verification procedure for every virtual host so an incident responder can find current and historical records without guessing.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




