'(WARN|ERROR)[ ]{1,}\[[\.a-z0-9A-Z]{1,}\]'
egrep '(WARN|ERROR)[ ]{1,}\[[\.a-z0-9A-Z]{1,}\]' -o server.log
To summarize, its necessary make uniq
count the rows, to do that, its necessary sort
them first (with the sort
command). Finnaly sort
it by total (with the -gr
parameters) and get the top 10 with head
(and the -n 10
parameter):
egrep '(WARN|ERROR)[ ]{1,}\[[\.a-z0-9A-Z]{1,}\]' -o server.log | sort | uniq -ic | sort -gr | head -n 10