You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Yuval Schwartz <yu...@gmail.com> on 2016/05/18 11:41:02 UTC

Linux Logging Rotate

Hello,

I am currently running a web application:

Tomcat: 8.0.22
JDK: 1.8.0_05
Server: Amazon Linux AMI

At the moment, I am simply using the default logging.
catalina.out
catalina.[date].log
localhost.[date].log
host-manager.[date].log
localhost_access_log.[date].log
manager.[date].log

These log files build up in my {catalina.base}/logs directory.

At the moment it's not a problem but eventually I would like to clear these
log files and store them somewhere (maybe send them to my email).

Does anyone have any solutions for what to do with these log files?
I looked into rotating them with logrotate but I read in a few places that
tomcat automatically rotates its log files and that I shouldn't override
this.

I will eventually probably implement more thorough logging for my
application.
But for the meantime, what should I do so that I don't have a ton of log
files in my logs directory?
Any way to automatically delete and email all log files with dates older
than one month?
Should I implement logrotate on catalina.out since this does not get dated?

Thank you

Re: Linux Logging Rotate

Posted by Anthony Biacco <ab...@handll.com>.
On Thu, May 19, 2016 at 11:47 PM, Yuval Schwartz <yu...@gmail.com>
wrote:

> Thanks Christopher, that's informative.
> I've decided to just manually move (via ftp) the dated files off the server
> and just clear Catalina.out (like your link says, the only unique output it
> includes is system.out/err).
>
> Eventually I will implement a more thorough logging solution.
> Let me know if you have any suggestions for something simple.


if you choose to let tomcat rotate them, you can choose to compress and
remove them when they are X days old with cron. just one solution.
something like this:

# compress rotated logs, remove 7 day old compressed logs
1 0 * * * [[ -d /path/to/logs ]]&& find /path/to/logs -maxdepth 1 -type f
-name "*.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].log" -exec bzip2 '{}'
\; ; [[ -d /path/to/logs ]]&& find /path/to/logs -maxdepth 1 -type f -mtime
+7 -name "*.bz2" -exec rm -f '{}' \;

but you're probably better off using logrotate to handle this
rotate/removal logic.

-Tony


>
> Thanks.
>
> On Friday, 20 May 2016, Christopher Schultz <ch...@christopherschultz.net>
> wrote:
>
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> >
> >
> > On 5/18/16 7:41 AM, Yuval Schwartz wrote:
> > > Hello,
> > >
> > > I am currently running a web application:
> > >
> > > Tomcat: 8.0.22 JDK: 1.8.0_05 Server: Amazon Linux AMI
> > >
> > > At the moment, I am simply using the default logging. catalina.out
> > > catalina.[date].log localhost.[date].log host-manager.[date].log
> > > localhost_access_log.[date].log manager.[date].log
> > >
> > > These log files build up in my {catalina.base}/logs directory.
> > >
> > > At the moment it's not a problem but eventually I would like to
> > > clear these log files and store them somewhere (maybe send them to
> > > my email).
> > >
> > > Does anyone have any solutions for what to do with these log
> > > files? I looked into rotating them with logrotate but I read in a
> > > few places that tomcat automatically rotates its log files and that
> > > I shouldn't override this.
> > >
> > > I will eventually probably implement more thorough logging for my
> > > application. But for the meantime, what should I do so that I don't
> > > have a ton of log files in my logs directory? Any way to
> > > automatically delete and email all log files with dates older than
> > > one month? Should I implement logrotate on catalina.out since this
> > > does not get dated?
> > >
> > > Thank you
> >
> > Does this help?
> > http://wiki.apache.org/tomcat/HowTo#How_do_I_rotate_catalina.out.3F
> >
> > - -chris
> > -----BEGIN PGP SIGNATURE-----
> > Comment: GPGTools - http://gpgtools.org
> > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
> >
> > iEYEARECAAYFAlc+OQkACgkQ9CaO5/Lv0PBsAACgpWGeCwhSkiTa7m8MYC7KMCae
> > N6EAn3moj/uRXdDHNfG9a1w/3/ypB7O4
> > =y7BX
> > -----END PGP SIGNATURE-----
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> <javascript:;>
> > For additional commands, e-mail: users-help@tomcat.apache.org
> > <javascript:;>
> >
> >
>

Re: Linux Logging Rotate

Posted by Yuval Schwartz <yu...@gmail.com>.
Thanks Christopher, that's informative.
I've decided to just manually move (via ftp) the dated files off the server
and just clear Catalina.out (like your link says, the only unique output it
includes is system.out/err).

Eventually I will implement a more thorough logging solution.
Let me know if you have any suggestions for something simple.

Thanks.

On Friday, 20 May 2016, Christopher Schultz <ch...@christopherschultz.net>
wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
>
> On 5/18/16 7:41 AM, Yuval Schwartz wrote:
> > Hello,
> >
> > I am currently running a web application:
> >
> > Tomcat: 8.0.22 JDK: 1.8.0_05 Server: Amazon Linux AMI
> >
> > At the moment, I am simply using the default logging. catalina.out
> > catalina.[date].log localhost.[date].log host-manager.[date].log
> > localhost_access_log.[date].log manager.[date].log
> >
> > These log files build up in my {catalina.base}/logs directory.
> >
> > At the moment it's not a problem but eventually I would like to
> > clear these log files and store them somewhere (maybe send them to
> > my email).
> >
> > Does anyone have any solutions for what to do with these log
> > files? I looked into rotating them with logrotate but I read in a
> > few places that tomcat automatically rotates its log files and that
> > I shouldn't override this.
> >
> > I will eventually probably implement more thorough logging for my
> > application. But for the meantime, what should I do so that I don't
> > have a ton of log files in my logs directory? Any way to
> > automatically delete and email all log files with dates older than
> > one month? Should I implement logrotate on catalina.out since this
> > does not get dated?
> >
> > Thank you
>
> Does this help?
> http://wiki.apache.org/tomcat/HowTo#How_do_I_rotate_catalina.out.3F
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iEYEARECAAYFAlc+OQkACgkQ9CaO5/Lv0PBsAACgpWGeCwhSkiTa7m8MYC7KMCae
> N6EAn3moj/uRXdDHNfG9a1w/3/ypB7O4
> =y7BX
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org <javascript:;>
> For additional commands, e-mail: users-help@tomcat.apache.org
> <javascript:;>
>
>

Re: Linux Logging Rotate

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 5/18/16 7:41 AM, Yuval Schwartz wrote:
> Hello,
> 
> I am currently running a web application:
> 
> Tomcat: 8.0.22 JDK: 1.8.0_05 Server: Amazon Linux AMI
> 
> At the moment, I am simply using the default logging. catalina.out 
> catalina.[date].log localhost.[date].log host-manager.[date].log 
> localhost_access_log.[date].log manager.[date].log
> 
> These log files build up in my {catalina.base}/logs directory.
> 
> At the moment it's not a problem but eventually I would like to
> clear these log files and store them somewhere (maybe send them to
> my email).
> 
> Does anyone have any solutions for what to do with these log
> files? I looked into rotating them with logrotate but I read in a
> few places that tomcat automatically rotates its log files and that
> I shouldn't override this.
> 
> I will eventually probably implement more thorough logging for my 
> application. But for the meantime, what should I do so that I don't
> have a ton of log files in my logs directory? Any way to
> automatically delete and email all log files with dates older than
> one month? Should I implement logrotate on catalina.out since this
> does not get dated?
> 
> Thank you

Does this help?
http://wiki.apache.org/tomcat/HowTo#How_do_I_rotate_catalina.out.3F

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlc+OQkACgkQ9CaO5/Lv0PBsAACgpWGeCwhSkiTa7m8MYC7KMCae
N6EAn3moj/uRXdDHNfG9a1w/3/ypB7O4
=y7BX
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org