-1

I'm currently redirecting all my service's standard output (stdout and stderr) to a single file, by starting is as such:

java blablaargs &> service.out
SVCPID=$!

However, that file grows quite large. Is it possible, without changing the service program itself (perhaps via some filter command), to split the output by day?

Note: "Use a logging framework in Java" is not the droi... answer I'm looking for, sometimes important output just goes to stdout, out of my control.

3 Answers 3

1

You should configure logrotate to do this for you - that's it's job.

0

Take a look at something like cronolog http://cronolog.org

It will do exactly what you ask for, splitting log files based on template, reading from STDIN.

0

I would suggest using syslog (for syslog-ng's filter and rotating capabilities for example), especially if you already use it in your system.

In order to catch stdout and stderr to syslog, you can pipe your program's output to logger, e.g. for example: (from https://blogs.oracle.com/chrisg/entry/redirecting_output_to_syslog)

my_script | logger -p local6.debug -t my_script 2>&1

see the man (1) logger.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .