Sponsored Content
Full Discussion: Not able to delete log file
Operating Systems Solaris Not able to delete log file Post 302865195 by Don Cragun on Thursday 17th of October 2013 11:26:43 PM
Old 10-18-2013
The commands:
Code:
>soa.out
>admin.out

deallocate all blocks allocated to those files at that time, but it doesn't close the file descriptors and does not reset the file offset that determines the position in the file where the next data written will be placed by in the processes that are writing to those files.

The next time the process writes something to one of those files, it will write it to the spot in the file just after the last place it wrote into that file. That will not allocate any disk blocks for the bytes in the file you previously deallocated, so what you end up with is known as a holey file which contains unallocated blocks that have never been written. If you try to read data from those blocks (such as by running cat soa.out), those unallocated blocks will appear as though null bytes had been written into those bytes.

If you change the program(s) that are writing those log files to add the O_APPEND flag to the oflag argument to the call to open() that opens the log files, it will reset the position in the log file where it writes data to the current end of file every time it writes to the log file. So, if you clear the log file using >logfile, the next write to the log file will be at the start of the file instead of leaving a huge hole at the start of the file.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

mass delete a certain string in a .log file

Hey all. I have a file that has roughly 115,000 lines in it. There are a few lines of information that I don't want in it, but I don't want to search through all of the lines to find the ones that I don't want. Is there a way to do a mass delete of the lines that I don't want? Thanks for the... (4 Replies)
Discussion started by: jalge2
4 Replies

2. Shell Programming and Scripting

how to delete blank rows in a log file

Help How to delete all blank rows in log file (4 Replies)
Discussion started by: suryanarayana
4 Replies

3. Shell Programming and Scripting

Delete lines prior to a specific date in a log file.

Hi all. I have a database log file in which log data get appended to it daily. I want to do a automatic maintainence of this log by going through the log and deleting lines belonging to a certain date. How should i do it? Please help. Thanks. Example. To delete all lines prior to Jun... (4 Replies)
Discussion started by: ahSher
4 Replies

4. Shell Programming and Scripting

Delete log file entries based on the Date/Timestamp within log file

If a log file is in the following format 28-Jul-10 ::: Log message 28-Jul-10 ::: Log message 29-Jul-10 ::: Log message 30-Jul-10 ::: Log message 31-Jul-10 ::: Log message 31-Jul-10 ::: Log message 1-Aug-10 ::: Log message 1-Aug-10 ::: Log message 2-Aug-10 ::: Log message 2-Aug-10 :::... (3 Replies)
Discussion started by: vikram3.r
3 Replies

5. Shell Programming and Scripting

Log file - Delete lines

Hello, I tried to search on the site a way to delete lines on log files but I didn't find what I am looking for... I hope someone will be able to help me. I do not know how to explain this, so I will do my best. I have a log file and I want to delete all second lines. Example : ... (3 Replies)
Discussion started by: Aswex
3 Replies

6. Shell Programming and Scripting

Delete log files content older than 30 days and append the lastest date log file date

To delete log files content older than 30 days and append the lastest date log file date in the respective logs I want to write a shell script that deletes all log files content older than 30 days and append the lastest log file date in the respective logs This is my script cd... (2 Replies)
Discussion started by: sreekumarhari
2 Replies

7. Red Hat

Need Script to ZIP/SAVE & then DELETE Log file & DELETE ZIPS older than 12 months

ENVIROMENT Linux: Fedora Core release 1 (Yarrow) iPlanet: iPlanet-WebServer-Enterprise/6.0SP1 Log Path: /usr/iplanet/servers/https-company/logs I have iPlanet log rotation enabled rotating files on a daily basis. The rotated logs are NOT compressed & are taking up too much space. I... (7 Replies)
Discussion started by: zachs
7 Replies

8. Shell Programming and Scripting

Delete all files from the directory except the ones in the log file

I have a log file with contents like below. Repository: https://someserver:9443/ Workspace: (1000) "test_scripts_ws" Component: (1001) "some_Automated_Scripts" Change sets: (1002) ---$ john "test memory" 17-Sep-2014 02:24 PM Changes: --a--... (9 Replies)
Discussion started by: gaurav99
9 Replies

9. UNIX for Dummies Questions & Answers

Log file - Delete duplicate line & keep last date

Hello All ! I need your help on this case, I have a csv file with this: ITEM105;ARI FSR;2016-02-01 08:02;243 ITEM101;ARI FSR;2016-02-01 06:02;240 ITEM032;RNO TLE;2016-02-01 11:03;320 ITEM032;RNO TLE;2016-02-02 05:43;320 ITEM032;RNO TLE;2016-02-01 02:03;320 ITEM032;RNO... (2 Replies)
Discussion started by: vadim-bzh
2 Replies

10. UNIX for Beginners Questions & Answers

Delete from another file that matched on log file

I want to write a script using Oscam Cardsharing server this is my test: cat oscam.log | grep "error" sample output: 2018/10/17 16:43:07 5C94A12E p (cccam) cccam(r) test.dyndns.org: login failed, error Once I've found an error, I need to remove its information inside another file : ... (5 Replies)
Discussion started by: vzoli1987
5 Replies
auditsvc(2)															       auditsvc(2)

NAME
auditsvc - write audit log to specified file descriptor SYNOPSIS
cc [ flag... ] file... -lbsm -lsocket -lnsl [ library... ] #include <sys/param.h> #include <bsm/audit.h> int auditsvc(int fd, int limit); The auditsvc() function specifies the audit log file to the kernel. The kernel writes audit records to this file until an exceptional con- dition occurs and then the call returns. The fd argument is a file descriptor that identifies the audit file. Applications should open this file for writing before calling auditsvc(). The limit argument specifies the number of free blocks that must be available in the audit file system, and causes auditsvc() to return when the free disk space on the audit filesystem drops below this limit. Thus, the invoking program can take action to avoid running out of disk space. The auditsvc() function does not return until one of the following conditions occurs: o The process receives a signal that is not blocked or ignored. o An error is encountered writing to the audit log file. o The minimum free space (as specified by limit), has been reached. The auditsvc() function returns only on an error. The auditsvc() function will fail if: EAGAIN The descriptor referred to a stream, was marked for System V-style non-blocking I/O, and no data could be written immedi- ately. EBADF The fd argument is not a valid descriptor open for writing. EBUSY A second process attempted to perform this call. EFBIG An attempt was made to write a file that exceeds the process's file size limit or the maximum file size. EINTR The call is forced to terminate prematurely due to the arrival of a signal whose SV_INTERRUPT bit in sv_flags is set (see sigvec(3UCB)). The signal(3C) function sets this bit for any signal it catches. EINVAL Auditing is disabled (see auditon(2)), or the fd argument does not refer to a file of an appropriate type (regular files are always appropriate.) EIO An I/O error occurred while reading from or writing to the file system. ENOSPC The user's quota of disk blocks on the file system containing the file has been exhausted; audit filesystem space is below the specified limit; or there is no free space remaining on the file system containing the file. ENXIO A hangup occurred on the stream being written to. EPERM The {PRIV_SYS_AUDIT} privilege is not asserted in the effective set of the calling process. EWOULDBLOCK The file was marked for 4.2 BSD-style non-blocking I/O, and no data could be written immediately. USAGE
Only processes with appropriate privileges can execute this call successfully. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Obsolete | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ auditd(1M), bsmconv(1M), audit(2), auditon(2), sigvec(3UCB), audit.log(4), attributes(5), privileges(5) The functionality described on this manual page is internal to auditd(1M) and might not be supported in a future release. The functionality described on this man page is available only if the Basic Security Module (BSM) has been enabled. See bsmconv(1M) for more information. 31 Mar 2005 auditsvc(2)
All times are GMT -4. The time now is 12:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy