1752590 Members
2853 Online
108788 Solutions
New Discussion юеВ

trim large log file

 
Asif_8
Regular Advisor

trim large log file

Hi!

How to trim large log file.
6935040073 Aug 22 10:09 wls_production.log
thanks
15 REPLIES 15
whiteknight
Honored Contributor

Re: trim large log file


Asif,

You can do

# > wls_production.log

this will nullify the log.

WK
Problem never ends, you must know how to fix it
Robert-Jan Goossens
Honored Contributor

Re: trim large log file

Hi,

Trim as in clear it?

# cp /dev/null wls_production.log

You could also save the last portion of the file to a backup file.

# tail -10000 wls_production.log > wls_production.log.1

and then empty the file.

Regards,
Robert-Jan
AwadheshPandey
Honored Contributor

Re: trim large log file

better to store trimed file to some where else rather than same place.
cp wls_production.log /newdir/wls_production.log
> wls_production.log

Regards,
It's kind of fun to do the impossible
Asif_8
Regular Advisor

Re: trim large log file

I can not null the file

>wls_production.log
Asif_8
Regular Advisor

Re: trim large log file


this is also not working
cp /dev/null wls_production.log
Dennis Handly
Acclaimed Contributor

Re: trim large log file

>I can not null the file
>wls_production.log

What do you mean? Don't want to? Or something prevents you?

>this is also not working
cp /dev/null wls_production.log

How? This isn't the best way to do it. Using ">" is the proper way.

If the file is open and being actively written, it probably won't help.
Asif_8
Regular Advisor

Re: trim large log file

this weblogic production server log
this file is open and being actively written,

I tried

>wls_production.log
/dev/null >wls_production.log
vi
ex
Robert-Jan Goossens
Honored Contributor

Re: trim large log file

Asif,

I don't know what version of weblogic you are running, but you can set up log rotation. Have a look at this doc.

http://e-docs.bea.com/wls/docs81/ConsoleHelp/logging.html#1047443

Regards,
Robert-Jan

Ps.
Dennis "This isn't the best way to do it" Well then you will need to rewrite a lot of documentation :-) example emr_na-c01025048-1
Dennis Handly
Acclaimed Contributor

Re: trim large log file

>this weblogic production server log. this file is open and being actively written,

As there a way to send a signal to it to restart the log? I.e. kill -HUP?