Home » Infrastructure » Unix » Shell Script (Unix (Ubuntu 10.0.4))
Shell Script [message #471855] Tue, 17 August 2010 11:03 Go to next message
Ricky_1362002
Messages: 90
Registered: February 2009
Member
Hi everyone,

I need to write an automated shell program that can create, monitor the log files and report the issues for matching pattern.

(i) Conditions for creating log files.
Log file is created with date (example 2010_03_27.log). If the log file size is 10 Mb for a particular day then automatically the log file will be rotated with sequence number (example, on a particular day if the log file crossed 10 MB while the data insert ii n progress, the program should rotate the log file with a sequence number YYYY_MM_DD_sequence_number.log)

(ii) Condition for reading the data for pattern matching
The report with matched pattern should be reported at the earliest for effective business decision. The data that is already processed shouldn't be considered for analysis for pattern matching.

Example file with sample data and mattching patterns

file01.log
2010-03-18 24:50:50:500: WorkingThread-1:User_Authorization_Failed session-id-10002033
2010-03-18 24:50:50:550: WorkingThread-1:User_Authentication_Failed session-id-10002033
2010-03-18 24:52:50:500: WorkingThread-1:User_Access_Locked session-id-10002033

Analyze the log for following pattern's:
1. Report number of 'User_Authorization_Failed'
2. Report number of 'User_Authentication_Failed'
3. Report number of 'User_Access_Locked'

Thank you,
Munna
Re: Shell Script [message #471858 is a reply to message #471855] Tue, 17 August 2010 11:08 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10613
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
And what does this have to do with Oracle?
Please post in a proper OS scripting forums.

Seems all you need is to grep and count the lines.

something like this

grep "yourpattern" | wc -l


The rest is handled by usual logrotate programs.

[Updated on: Tue, 17 August 2010 11:09]

Report message to a moderator

Re: Shell Script [message #471860 is a reply to message #471858] Tue, 17 August 2010 11:28 Go to previous message
Ricky_1362002
Messages: 90
Registered: February 2009
Member
Thank you Mahesh for your reply.

I guess nothing really to do with Oracle but i thought its under the Unix topic and can get some answers.

Thank you again.
Munna
Previous Topic: Performance issue in reading file in unix
Next Topic: Automation script
Goto Forum:
  


Current Time: Sat Apr 19 16:01:03 CDT 2014

Total time taken to generate the page: 0.11424 seconds