My jboss application server generate some pretty big log files, often around 8 to 10 gb.How can I view these log files in my redhat linux server?
Try using the split command.
And yes, rotate your log files more often. It's a heinous crime not to.
I usually use
You can also use
You could also use a 'head' to list the first lines or a 'tail' to list the end of the file. If you append a number after the 'head' or the 'tail', it will display that number of lines.
We have a similar issue here (large logfiles though not JBoss), and all I can say is, "grep is your friend". I assume your logfiles look something like this:
(these are pulled from a /var/log/messages file, but the idea is that every entry is preceded by a timestamp).
Given that your logfile is filled with timestamps, what I do is something akin to the following:
grep '^`date "+%b %d"` 08:14' /my/log/file > /tmp/814amLog.txt
Which really is just grep'ing for today's timestamp, ie,
grep "^Dec 27 08:14" /my/log/file > /tmp/814amLog.txt
Then I less or vim -R the 814amLog.txt file. The idea is to get it into a bite-sized chunk that you're interested in.
The split command given as the first reply is usable, but in my experience gives rather arbitrary results. Usually I'm looking for something that happened "about this time". So grep'ing by date and time is used more often.
You can script a cron job to grep through your logfiles at night and save them in an appropriate place, so you don't have to do it adhoc. I also highly recommend creating a job to gzip compress log files older that a day or so, as you will be amazed at how much disk space you save.