Parsing a Log file

Hi All,

I'm deffently not a Unix specialist so be Gentel.
I need to parse a Log file that looks like that:

2006-06-12 01:00:00,463 ERROR [shared.logger.LoggerCleaner] {cleanLoggersFiles} General Error
comverse.compas.shared.exceptions.SystemParametersException: Error in reading parameter FileLocation
at comverse.compas.shared.paramhandler.SystemParametersDelegate.getStringValue(SystemParametersDelegate.java:186)
at comverse.compas.shared.logger.LoggerCleaner.cleanLoggersFiles(LoggerCleaner.java:110)
at comverse.compas.shared.logger.LoggerCleaner.run(LoggerCleaner.java:66)

My request is to Count the number of 'Error' occurences in the file in the current day, starting 00:00 till 00:00

Whats the best way to do that?

Thanks
Tal

Try this command :

grep -c "`date +'%Y-%m-%d'`[ 0-9:,]*ERROR" /path/to/log_file

Jean-Pierre.

Thanks Jean-Pierre,
I have tried the command but havent received the expected result. I have also tried your command by giving a specific date and it still doent work:

grep -c "2006-06-18 [0-9:,] *ERROR" SPMAgent_Debug.log
0
dsu001-sys01a:/var/cti/logs/spmagent ROOT > grep "2006-06-18" SPMAgent_Debug.log
2006-06-18 01:00:00,528 ERROR [shared.logger.LoggerCleaner] {cleanLoggersFiles} General Error

As U can see I hace the sring ERROR on the 18th but using the command I get the counter 0

any thoughts
Tal

I'm not sure what's going on - Jean-Pierre seems to have a good regex.
start with this:

grep '^2006-06-18 ' SPMAgent_Debug.log | grep -c ' ERROR '

Looks like a trypo?
You have:

grep -c "2006-06-18 [0-9:,] *ERROR" SPMAgent_Debug.log

instead of (the space is after the [, not before it)

grep -c "2006-06-18[ 0-9:,] *ERROR" SPMAgent_Debug.log