Can't execute logadm proberly


 
Thread Tools Search this Thread
Operating Systems Solaris Can't execute logadm proberly
# 1  
Old 07-28-2015
Can't execute logadm proberly

Hello,

I am trying to rotate my logs using logadm, so I did the following
Code:
logadm -w /traces/mylogs.out -C 5 -p 1d -o user -g group -m 644 -c -t '/traces/mylogs.out.$n' -z 1

and then tried to test it by logadm -v and it gets stuck at truncation step
Code:
# processing logname: /traces/mylogs.out
mkdir -p /traces # verify directory exists
# log rotation via atomic copy and truncation (-c flag):
# copy /traces/mylogs.out to /traces/mylogs.out.0
# truncate /traces/mylogs.out

^C


I actually had to stop its processing because it took longer time and can see it eats my diskspace by creating a file with blank lines
Code:
# du -sh mylogs.out*
  76M   mylogs.out
  29G   mylogs.out.0


when I checked mylogs.out.0, I found it is just full of blank lines which I don't understand why!
Could you please advise in this?

Thanks.

Last edited by Don Cragun; 07-28-2015 at 10:57 PM.. Reason: Add CODE and ICODE tags.
# 2  
Old 07-29-2015
This User Gave Thanks to DukeNuke2 For This Post:
# 3  
Old 07-29-2015
I believe that I followed the exact instructions there, still not working Smilie

---------- Post updated at 07:43 PM ---------- Previous update was at 04:21 PM ----------

I noticed also something in the logs permission -rw-r-lr--
What does ( l ) in the middle mean here? I am not sure if this is because of my action?
# 4  
Old 08-19-2015
Normally you do not need -o user -g group -m 644 because it picks the attributes from the logfile.
(The same feature was in the Linux logrotate, until they found a security bug in connection with its globbing feature.)
To your problem:
according to man ls the l or L means "mandatory locking" and can indeed cause a problem, e.g. logadm or cp waits until the lock is released.
Can you manually cp the logfile?
# 5  
Old 08-19-2015
Hi,
Thanks for the notes Smilie Good to know that!
The problem is solved after restarting the process to force recreating the log in a clean manner.
It looks that my intervention to free it by redirecting /dev/null to it, caused this issue I think!
Anyway after removing it and starting the process, I was able to apply logadm on it with no problem using the same command.

Thanks.
# 6  
Old 08-20-2015
Sometimes the better alternative is to not use the -c option,
instead signal the process to close/open its logfile by means of the -a option.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to logrotate a file after X days with logadm?

Hi Guys - We have the /var/adm/pacct file currently configured to log rotate using logadm - here is the entry in logadm.conf: /var/adm/pacct -C 0 -N -P 'Wed Oct 23 08:00:00 2013' -a '/usr/lib/acct/accton pacct' -g adm -m 664 -o adm -p never Just want to ask if it would like possible to... (1 Reply)
Discussion started by: akaterasu
1 Replies

2. Shell Programming and Scripting

Logadm

I need to delete the logs using logadm command. we have application that generates to logs automatically with different dates every day like error_20121121.log and so on... using lodadm can i delete the logs of last 10 days using crontabentry? i am confuse here becasue if we use logadm what... (1 Reply)
Discussion started by: phani4u
1 Replies

3. Solaris

logadm rotates log every time

I'm running logadm manually to test and it seems to be rotating my /var/log/oracle/oracle_audit.log file every single time it's ran instead of rotating once it gets passed 10 gigs, any ideas? Here's the logadm.conf for reference. (0 Replies)
Discussion started by: thmnetwork
0 Replies

4. Solaris

LOGADM

Dear experts. I was wondering if logadm preserves ACL setuped on for instance, /var/log/authlog. From man : ...by creating an empty file whose owner, group ID, and permissions match the original file.... Is this ACL inclusive or i need to use -a option (run cmd after... (1 Reply)
Discussion started by: Peasant
1 Replies

5. Solaris

Couple logadm questions

My logadm.conf is below. Is there a way to match a log file that appends the time/date stamp after the log file? Also, a 0 is being appended onto the files I'm compressing and having rotated. Is there a way to fix that? /var/apache/tomcat55/logs/catalina.out -C 30 -P 'Fri Jun 18 16:48:55... (5 Replies)
Discussion started by: LittleLebowski
5 Replies

6. Solaris

Problems with logadm / syslog in Sol 9/10

Hello folks, I've been making some changes to logadm.conf, but I'm not getting quite the results that I'm expecting /var/log/pool/poold -a 'pkill -HUP poold; true' -N -s 512k /var/svc/log/*.log -C 8 -N -s 1m /var/adm/messages -a 'pkill -HUP `cat /var/run/syslog.pid`' -C 8 -s 10m... (10 Replies)
Discussion started by: avronius
10 Replies

7. Solaris

logadm

I have a log file that I want to rotate each day without keeping old copies. how to achieve that? thx (3 Replies)
Discussion started by: melanie_pfefer
3 Replies

8. Solaris

logadm package

Does anyone know what package logadm is part of? It's not on my Solaris 9 machine, I presume because I only have a core installation. But I'd like to ad it. Any help would be appreciated. (1 Reply)
Discussion started by: syscity
1 Replies

9. Shell Programming and Scripting

Need to execute 2 scripts, wait, execute 2 more wait, till end of file

:cool: I need to execute a shell script to do the following: cat a file run two back ground processes using the first two values from the file wait till those background processes finish run two more background processes using the next two values from the file wait till those background... (1 Reply)
Discussion started by: halo98
1 Replies

10. Solaris

crontab logadm vs. logchecker in Solaris 10

We are upgrading netra servers from Solaris 8 to Solaris 10. With Solaris 8 we've been running /etc/cron.d/logchecker and /usr/lib/newsyslog in crontab. I understand that starting with Solaris 9 log rotation is now done with /usr/sbin/logadm. Does anyone know how the Solaris upgrade will handle... (1 Reply)
Discussion started by: dawinkler
1 Replies
Login or Register to Ask a Question

Featured Tech Videos