Sponsored Content
Top Forums Shell Programming and Scripting How to reallocate the deleted logfile space? Post 302930269 by achenle on Thursday 1st of January 2015 12:02:31 PM
Old 01-01-2015
Quote:
Originally Posted by Chubler_XL
Yes, after you have deleted the file there is little you can do to recover the allocated space apart from killing and restarting the process(es) that have the file open.

As RudiC points out you are better off writing zero size to the logfile eg:

Code:
# truncate -s0 /var/log/httpd/access_log

Or

Code:
# :> /var/log/httpd/access_log

As a long-term solution you should consider using the logrotate daemon to keep your logfile sizes down.
And don't be surprised if that doesn't work.

There are ways for applications to write to log files that create problems with that method. One of them is redirecting stderr/stdout by using ">>" shell redirection.

If those methods are used, filesystem-specific features can come into play.

There's a reason why operating systems provide robust, scalable logging facilities. Scalable logging is not something that can be done reliably without serious work.

So if your app is not well-designed, you may be stuck with "kill the app, clean up the log file, restart the app".
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to keep white space is being deleted using read

I am using Posix shell to write a script. The problem I am having is that when I use the read command to go through a file I lose the tabs. How can I keep this from happening? (1 Reply)
Discussion started by: keelba
1 Replies

2. Shell Programming and Scripting

last month's logfile

hi friends I need a shell script which will do the following Task Enter the month : if you enter 1 then it ll show you last 1 month's (starting from today).log file in the current directry. if you enter 4 then it ll show you last 4 month's (starting from today).log file in the current... (2 Replies)
Discussion started by: deep_kol
2 Replies

3. Shell Programming and Scripting

logfile

hi iam new of the ksh script.iwant in formation of how to call in logfile in ksh scripts. if the meaning in ksh. please help me thanks naveen.g (1 Reply)
Discussion started by: naveeng.81
1 Replies

4. Shell Programming and Scripting

Calculate total space, total used space and total free space in filesystem names matching keyword

Good afternoon! Im new at scripting and Im trying to write a script to calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Discussion started by: bigben1220
4 Replies

5. UNIX for Dummies Questions & Answers

Reclaim deleted disk space

I have a disk space issue on one of my unix servers. it is showing 98% full.. i found the offending folder and removed it. but i have not reclaimed the disk space. is there another command that i need ? thank you in advance for any assistance. (4 Replies)
Discussion started by: JanSP
4 Replies

6. Shell Programming and Scripting

xrealloc: cannot reallocate (23523666) bytes

Hi, I have a lengthy shell script and when I try to run it, It takes a lot of time and for about 25-30 mins and outputs this message xrealloc: cannot reallocate (23523666) bytes (0 bytes allocated). Along with this it is also displaying two other error messages. One is it is saying the... (3 Replies)
Discussion started by: nagin
3 Replies

7. UNIX for Advanced & Expert Users

figure out how part of a logfile got deleted

I there a way to figure out how part of a logfile got deleted? I know unix does not have a date created date so that makes things very difficult to tell if the file got deleted or not. Several thousand lines of my .bash_history somehow got deleted. I still have this in my .bashrc so I don't... (0 Replies)
Discussion started by: cokedude
0 Replies

8. Shell Programming and Scripting

Logs from logfile

Hi Team, Have to write a shell script to pick only 1 hr logs from the generated logfile and send it to other logfile. Thanks & Regards, Indu (3 Replies)
Discussion started by: indira_s
3 Replies

9. Shell Programming and Scripting

Logfile monitoring with logfile replacement

Bonjour, I've wrote a script to monitor a logfile in realtime. It is working almost perfeclty except for two things. The script use the following technique : tail -fn0 $logfile | \ while read line ; do ... some stuff done First one, I'd like a way to end the monitoring script if a... (3 Replies)
Discussion started by: Warluck
3 Replies

10. Red Hat

Files not getting deleted with rm & occupying space in filesystem

Hello, OS version is Red Hat Enterprise Linux Server release 6.5 (Santiago). In one of the filesystem some old files post clone are not getting removed even with 'rm' # ls -ltr | grep meagpd_62.dbf -rw-rw---- 1 oracle oinstall 34358697984 Sep 1 08:46 meagpd_62.dbf # rm... (7 Replies)
Discussion started by: saharookiedba
7 Replies
PENLOGD(1)						      General Commands Manual							PENLOGD(1)

NAME
penlogd - consolidate web server logs SYNOPSIS
penlogd [-fd] [-j dir] [-l logfile] [-n N] [-p pidfile] [-u user] port EXAMPLE
penlogd -l /var/log/access_log -p /var/run/penlogd.pid 10000 DESCRIPTION
Penlogd receives log entries from Pen and from each of the web servers. It consolidates the entries by replacing the source addresses in each entry with the "real" client address and writes the result to stdout or to the file given on the command line. This completely removes the need for postprocessing with mergelogs, since the logs are already merged. Pen must be instructed to send its log to penlogd. See HOWTO and pen man page for details. Sending penlogd a HUP signal will make it close and reopen the logfile, unless it is logging to stdout. Rotate the log like this: mv access_log access_log.1 kill -HUP `cat <pidfile>` where <pidfile> is the file containing pen's process id. Sending penlogd a TERM signal will make it close the log file and exit cleanly. OPTIONS
-d Turn on debugging. The output goes to stderr if we are running in the foreground (see -f) and to syslog (facility user, priority debug) otherwise. -f Stay in foreground. -j dir Run in a chroot environment. -l logfile Write output into logfile. -n N Number of pen log entries to cache (default 1000). -p pidfile Write process id into pidfile. -u user Run as a different user. port The UDP port where penlogd receives log entries. SEE ALSO
pen(1), penlog(1), webresolve(1) AUTHOR
Copyright (C) 2002-2003 Ulric Eriksson, <ulric@siag.nu>. LOCAL PENLOGD(1)
All times are GMT -4. The time now is 01:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy