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
oldlog2new(8)						      System Manager's Manual						     oldlog2new(8)

NAME
oldlog2new - Convert an NCSA httpd 1.1 access_log file to CLF access_log SYNOPSIS
oldlog2new [ -hez ] [ -f logfile ] [ -s srmfile ] DESCRIPTION
Convert an NCSA httpd 1.1 access_log file to CLF access_log OPTIONS
Display Options: -h Help -- just display this message and quit. -e Display all invalid log entries on STDERR. (default is to ignore them) Input Options: -f Read from the following access_log file instead of the default. -z Use zcat to uncompress the log file while reading [requires -f]. -s Get the server directives from the following srm.conf file. SEE ALSO
crontab(1), httpd(1m), perl(1), wwwstat(1), splitlog(1), monthly(8), oldlog2new(8) More info and the latest version of oldlog2new can be obtained from http://www.ics.uci.edu/pub/websoft/wwwstat/ ftp://www.ics.uci.edu/pub/websoft/wwwstat/ If you have any suggestions, bug reports, fixes, or enhancements, please join the <wwwstat-users@ics.uci.edu> mailing list by sending e- mail with "subscribe" in the subject of the message to the request address <wwwstat-users-request@ics.uci.edu>. The list is archived at the above address. 18 November 2004 oldlog2new(8)
All times are GMT -4. The time now is 03:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy