shell - Combining tail and sed command and redirecting them to new file -
i connecting multiple remote servers , displaying there log files using tail command local system. log files generating dynamically not able differentiate them. thinking redirect log file , serevrid each line of log file other temporary file , tail temporary file, on local machine can differentiate different servers log file.
i using
(sed -e '/s/^/192.168.12.1' /logs/a.log; tail -f /logs/a.log) > b.log tail -f b.log
but few starting lines getting updated serverid , not lines after dynamically generating. kindly tell me how concatenate serverid each line of log file.
sed --unbuffered -e 's/^/192.168.12.1/' /logs/a.log >> b.log tail -f b.log
should enough if want file simple
sed --unbuffered -e 's/^/192.168.12.1/' /logs/a.log
will work normaly
Comments
Post a Comment