Thursday, November 1, 2012

Linux log files various ways to log

let's say the application has a log output:
Overwrite:
wget -o logfilename.ext ...
Append:
wget -a logfilename.ext ...
Overwrite with a date log:
wget -o logfilename_`date +%Y-%m-%d`.ext ...
This gives you a daily log output.

Output goes to stdout:
Overwrite:
echo "something" > logfile
Append: (creates if not exist)
echo "something" >> logfile
Daily log:
echo "something" >> logfile_`date +%Y-%m-%d`

Output (errors) goes to stderr
include with your standard log:
echo "something" > logfile 2>&1

No comments:

Blog Archive