iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
On Ubuntu, Apache writes request records to /var/log/apache2/access.log and server diagnostics to /var/log/apache2/error.log by default. You can give each virtual host its own files with CustomLog and ErrorLog, then let Ubuntu’s logrotate rename, compress and retain those files without stopping the web server.
The critical operational detail is reopening the files after an external rotation. A postrotate action that reloads Apache makes it close the old file handles and open the newly created logs. Without that reload, Apache can continue writing to a renamed file that no longer appears to be the active log.
Understand Apache’s log destinations on Ubuntu
Ubuntu’s standard Apache package defines two main destinations:
| Purpose | Default path | Directive that changes it |
|---|---|---|
| HTTP requests and responses (transfer/access records) | /var/log/apache2/access.log |
CustomLog |
| Apache startup, runtime and request-processing errors | /var/log/apache2/error.log |
ErrorLog |
The default files are useful for a single-site server, but separate files per virtual host make investigation, retention and access control much easier. A request record normally includes the client address, timestamp, request line, status code and response size when the combined format is selected. Error records contain messages generated by Apache modules, the core server and virtual-host processing.
#1 Best Overall
- Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
- With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
- Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
- Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
- Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.
Apache also supports piped logging. If the argument to CustomLog or ErrorLog begins with a vertical bar (|), Apache starts the specified logging program and sends records to it instead of opening a regular file directly. Piped logging is the basis for the rotatelogs alternative described later.
Assign separate logs to a virtual host
Virtual-host directives belong in the site definition under /etc/apache2/sites-available/. A minimal HTTP virtual host with dedicated files is:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →<VirtualHost *:80>
ServerName example.com
CustomLog ${APACHE_LOG_DIR}/example_access.log combined
ErrorLog ${APACHE_LOG_DIR}/example_error.log
</VirtualHost>
${APACHE_LOG_DIR} is Ubuntu’s configuration variable for the Apache log directory; it normally resolves to /var/log/apache2. Using the variable keeps the site definition consistent with the distribution’s layout. The final word on CustomLog selects the log format. combined is a commonly enabled format that records more request context than the basic format.
Choose names and locations deliberately
Use a predictable name that identifies the site, such as example_access.log and example_error.log. Keeping files below ${APACHE_LOG_DIR} allows the package’s normal rotation policy to match them. If you place logs elsewhere, you must create the directory, set safe ownership and permissions, and add a matching logrotate rule; otherwise rotation may silently miss the files or create them with unsuitable access.
Understand directive scope
CustomLog records requests handled by the virtual host where it is declared. ErrorLog receives errors associated with that virtual host, while errors occurring before Apache can select a host can still appear in the global error log. A site-specific file therefore complements rather than necessarily replaces the global file.
Rank #2
- Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
- Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
- Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
- Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
- Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
Enable the site and apply the configuration safely
Save the virtual-host definition, for example as /etc/apache2/sites-available/example.conf. Enable it, check the complete configuration, and perform a graceful reload:
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows 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 reinstall- Enable the definition:
sudo a2ensite example.conf - Validate syntax and references:
sudo apache2ctl configtestProceed only when the command reports
Syntax OK. A typo in a directive, an unmatched section tag or an unavailable module must be fixed before reloading. - Reload without stopping workers:
sudo systemctl reload apache2A reload asks the running service to adopt the new configuration while continuing to serve existing connections. It is the appropriate operation after changing log directives.
- Watch both files while making a request:
sudo tail -f /var/log/apache2/example_access.log /var/log/apache2/example_error.logRequest the site from another terminal or browser. The access file should receive a line for the request; the error file should remain quiet unless Apache reports a problem.
If a2ensite reports that the site is already enabled, do not create a second symlink. Edit the existing file, run configtest again and reload once.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsRank #3
- 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
- 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
- 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
- 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
- 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
Plan rotation around traffic and retention
Log rotation solves two separate problems: preventing unbounded files from consuming disk space and preserving older records for troubleshooting or compliance. Ubuntu’s normal mechanism is logrotate, with policies stored as files under /etc/logrotate.d/. A policy can rotate on a calendar (daily, weekly or monthly), when a file reaches a size threshold, or according to both rules.
Before choosing values, estimate how quickly the busiest access and error files grow. Then balance:
- Disk capacity: high-volume sites may require more frequent rotation or shorter retention.
- Incident-response needs: keeping additional compressed generations makes it possible to investigate an attack discovered weeks later.
- Legal or contractual retention: a policy may require a minimum period that is longer than your disk budget; move archives to an approved storage system rather than quietly deleting them.
- Compression overhead: compression saves space but consumes CPU and I/O during rotation.
delaycompresspostpones compression of the newest rotated file until the next cycle.
Do not treat a sample value such as fourteen rotations as a universal recommendation. Retention must match the factors above and any organization-specific policy.
Create a logrotate policy for Apache
Create or edit a file such as /etc/logrotate.d/apache2-custom. The following policy covers standard and virtual-host log files:
Free tools Windows power users keep installed
One-click scans. No signup required.
/var/log/apache2/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
sharedscripts
postrotate
systemctl reload apache2 > /dev/null 2>&1 || true
endscript
}
Each directive has a distinct purpose:
| Directive | Effect | Operational consideration |
|---|---|---|
daily |
Checks the files on a daily schedule. | Rotation still occurs only when logrotate itself runs; the schedule is not a daemon. |
missingok |
Continues when a matching file does not exist. | Useful when a virtual host is disabled or has not generated a log yet. |
rotate 14 |
Keeps fourteen old generations before removing the oldest. | Change this number to meet storage and retention requirements. |
compress |
Compresses rotated generations. | Readers must decompress archives before examining them. |
delaycompress |
Leaves the most recently rotated generation uncompressed until the following cycle. | Helpful when another process may still need immediate access to the newest archive. |
notifempty |
Skips rotation of an empty file. | A quiet site does not produce a series of empty archives. |
sharedscripts |
Runs the script block once for the group of matching files rather than once per file. | Prevents a reload for every individual virtual-host log. |
postrotate … endscript |
Runs commands after renaming the files. | The reload is essential for Apache, as explained below. |
The redirection in the example keeps routine reload output out of logrotate’s own output. || true prevents a transient reload failure from aborting the rest of logrotate’s run; you should still monitor the service and fix a persistent failure rather than hide it.
Rank #4
- 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
- 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
- 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
- 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
- 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
When a custom directory needs extra directives
If logs live outside /var/log/apache2, the policy must match that exact path. You may also need a create directive so that the replacement file is created with the required mode, owner and group. Verify those values against the account and group that Apache uses on your Ubuntu installation. Incorrect ownership can make the next write fail, while overly broad permissions expose client addresses, URLs and diagnostic details.
Test a policy before changing files
Use logrotate’s debug mode to inspect what it would do without modifying state:
sudo logrotate --debug /etc/logrotate.conf
The command reads the main configuration and included policies, reports matching files and actions, and makes no changes. Check that your virtual-host names are included and that no unintended path is matched.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
To perform one intentional rotation, use:
sudo logrotate --force /etc/logrotate.conf
--force rotates even when logrotate’s state says the files are not yet due. Use it for a controlled test or an urgent rollover, not as a substitute for setting an appropriate schedule. Running it repeatedly can create unnecessary generations and consume I/O.
Why Apache must be reloaded after rotation
External rotation normally renames the active file and creates a new file with the original name. A running process can continue writing through the old open file handle even though that pathname now refers to a different inode. Apache’s logging documentation specifically requires the logrotate postrotate script to include a reload (or an equivalent signal) for this reason.
Best Value
- 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
- 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
- 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
- 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
- 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
The reload tells Apache to close its existing log descriptors and open the current paths again. It does not require a full stop/start cycle, so the site can continue serving while the logging handles are replaced. If the reload is omitted or fails, the apparently active file may remain unchanged while the renamed file grows. Disk usage then increases in an archive that administrators assume is closed.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Verify that the new file is active
After a real rotation, generate a request and inspect both the directory and the current file:
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 a newly created example_access.log and a renamed older generation (possibly compressed according to the policy). The curl request should add a fresh line to the new active file. Compare file sizes before and after if you suspect the old file is still growing.
Diagnose an old-file handle
- If the new file stays at zero bytes after a confirmed request, run
sudo systemctl reload apache2and test again. - If the renamed generation continues to grow, inspect the output and exit status of the postrotate reload, then check
sudo systemctl status apache2for configuration or permission errors. - If Apache will not reload, run
sudo apache2ctl configtestbefore changing the rotation policy. A configuration error must be corrected first. - If files are recreated with the wrong owner or mode, review the directory permissions and any
createdirective, then perform a controlled rotation.
Use Apache’s rotatelogs when piped rotation fits
Apache includes rotatelogs, a helper used through piped CustomLog or ErrorLog directives. It can rotate by elapsed seconds or by file size. Ubuntu documentation shows examples for a 24-hour interval (86,400 seconds), local-midnight naming, and a 5-megabyte threshold.
CustomLog "|/usr/bin/rotatelogs /var/log/apache2/example_access.log 86400" combined
ErrorLog "|/usr/bin/rotatelogs /var/log/apache2/example_error.log 5M"
With this arrangement Apache writes to the helper process, which creates successive files as the time or size condition is reached. The helper path must exist on the host, and the Apache service account must be able to write to the destination directory. Validate the complete configuration and reload Apache after adding piped directives.
rotatelogs does not automatically replace the host’s broader retention and compression policy. If you need a defined number of generations, compressed archives, permission recreation and a common operational workflow across services, an external logrotate policy is usually easier to standardize. That preference is an operational choice based on the documented capabilities of both mechanisms, not a requirement that applies to every deployment.
Recommended Free Tools
Choose between logrotate and rotatelogs
| Requirement | Use logrotate | Use rotatelogs |
|---|---|---|
| Centralized Ubuntu policy for many services | Strong fit; one policy style can cover Apache files and other daemons. | Requires separate piped definitions per log stream. |
| Compression and a fixed retention count | Provides compress, delaycompress and rotate. |
Not supplied by the basic rotation examples; additional handling is required. |
| Rotation strictly by elapsed time or file size inside Apache | Can express schedules and size conditions through logrotate’s policy. | Directly supports interval and size thresholds in the pipe command. |
| Reload after an external rename | Required in postrotate. |
The helper receives records continuously; no external rename is involved in the basic setup. |
| Existing operational tooling | Best when administrators already monitor logrotate state and archives. | Best when Apache-managed piped logging is already part of the design. |
Protect log contents and the log directory
Access and error logs can contain client addresses, requested URLs, referrers, user-agent strings and detailed failure information. Treat them as sensitive operational data:
Quick Recap
- Keep the log directory writable only by the Apache service and trusted administrators. Apache’s documentation warns that granting broad write access to its log directory can create serious security consequences.
- Do not record passwords, authorization headers, session tokens or other secrets in custom formats. If a reviewed requirement calls for personal data, define access controls, retention and deletion procedures before enabling it.
- After the first rotation, inspect ownership and mode on both the active file and an archive. Custom paths and
createdirectives are common places for accidental exposure. - Restrict access to compressed generations as well as current files; compression does not make their contents less sensitive.
Operational checklist
- Identify whether the request belongs in the global logs or a particular virtual host.
- Declare
CustomLogandErrorLogin the relevant file under/etc/apache2/sites-available/. - Keep paths under
${APACHE_LOG_DIR}unless you have a reason to manage a custom directory. - Enable the site, run
sudo apache2ctl configtest, and reload Apache. - Confirm that a test request appears in the intended access file.
- Write a matching file under
/etc/logrotate.d/with frequency, retention, compression and permission settings that meet your requirements. - Include
systemctl reload apache2(or an equivalent reload) inpostrotate. - Run
sudo logrotate --debug /etc/logrotate.confto check the policy without changing files. - Perform one controlled
--forcerotation, make a request, and verify that the new active file grows while the archive stops growing. - Monitor future rotations and investigate any reload, ownership or disk-space error immediately.
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.

