Sponsored Content
Full Discussion: Monitoring log file
Top Forums Shell Programming and Scripting Monitoring log file Post 302284202 by cbkihong on Thursday 5th of February 2009 01:33:22 AM
Old 02-05-2009
Of course you can do some scripting like grep or perl yourself coupled with a cron schedule for a more typical sysadmin way to do it. However, I believe fellow users here are far more experienced in this sort of scripting so I tend not to speak so much.

Pardon me for a bit of irrelevence to your question. However, I don't think monitoring the log file as a solution to handling "out of memory" is a good approach.

Just to share with you what happened recently with me. In fact I have a test virtual server running JBoss in it, the JBoss died on 24/1 and OutOfMemory was never observed until yesterday. This is because it was a test VM and nobody else would be accessing that unless I need to. The exception was logged but according to log it took just a few minutes afterwards that the JVM crashed to such a state that even the logging system failed. Luckily that was not a production machine.

Monitoring the log file, you cannot be polling it all the time. However, whenever a process gets the chance to poll and find that the exception was logged, the JVM has already been in a dead state and you'll still suffer downtime before the restart is complete - just that you know it sooner to avoid the kind of several days of non-discovery otherwise.

If your situation permits, a better approach is to intervene before the JVM gets out of memory, so that you can plan for a graceful restart ahead and avoid all those embarrassness. Today's JVM already have monitoring mechanism builtin (JMX) that you can easily monitor the memory consumption locally or remotely, unless you're still using old JVMs like 1.x that did not have this feature. So if you see the heap size is over a certain threshold say 70% then an email will be sent to you. Well, I believe this is exactly a reason I would invite others to consider migrating to a more recent JVM ......
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

log monitoring

Hi there, I have an application runnig on HP_UX which logs critical mesages to a log file. What I would like to do is tail the log file and report on new messages. Easy....I here you say. The log file is continuing to be written to and the check scritp will be executed from cron. I was... (2 Replies)
Discussion started by: nhatch
2 Replies

2. Shell Programming and Scripting

help needed - log file monitoring script

hi Gurus, Need to pick your brains on this minor script project. I would like to continuously monitor a log file with sample log messages as below, and if PSOldGen percentage is either 99% or 100% for consecutively 10 times, alert someone. {Heap before gc invocations=46516: PSYoungGen ... (6 Replies)
Discussion started by: kenchen722
6 Replies

3. Shell Programming and Scripting

Tomcat Monitoring log file

Hi, I ned to monitor the tomcat log file called "catalina.out" for "OutOfMemory" ,"java.sql.SQLException" and "Error" error. the script should monitor this file (catalina.out) and send us the mail as soon as it finds the string "Out of memory" or "java.sql.SQLException" or "Error" in the... (2 Replies)
Discussion started by: mnmonu
2 Replies

4. Solaris

Monitoring log file for entries - Find command & sorting

hi, I would like to monitor a log file, which rolls over, everytime a server is restarted. I would like to grep for a string, and to be more efficient i'd like to grep only newly appended data. so something like a 'tail -f' would do, however, as the log rolls over i think a 'tail -F' is... (2 Replies)
Discussion started by: horhif
2 Replies

5. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

6. Shell Programming and Scripting

Monitoring script for a log file

Hi, I need to get a script working to monitor a log file and throw an alert via mailx as soon as a particular error is encountered. I do not want repeatative email notifications of same error so simply cat logfile and grepping the error would not work. Here is what i planned but it seems... (2 Replies)
Discussion started by: roshan.171188
2 Replies

7. UNIX for Advanced & Expert Users

Alternative to tail -n -0 -F for monitoring live log file

Hello, I have been working on script which need to generate an alert based upon live logs. If string is found then an alert mail must triggered. tail -n -0 -F works fine to redirect the each latest line from live logs file to grep a pattern for matching but it seems to be not working on... (7 Replies)
Discussion started by: ketanraut
7 Replies

8. UNIX for Beginners Questions & Answers

Monitoring script for Log file

Hi, Iam new to unix , plz help me to write below script. I need to write a script for Monitoring log file when any error occurs it has to send a mail to specified users and it should be always pick latest error not the existing one and the script should be able to send mail all errors (more... (1 Reply)
Discussion started by: vij05
1 Replies

9. Shell Programming and Scripting

Monitoring processes in parallel and process log file after process exits

I am writing a script to kick off a process to gather logs on multiple nodes in parallel using "&". These processes create individual log files. Which I would like to filter and convert in CSV format after they are complete. I am facing following issues: 1. Monitor all Processes parallelly.... (5 Replies)
Discussion started by: shunya
5 Replies

10. UNIX for Beginners Questions & Answers

Shell script for continuously monitoring log file

Hi I have written below log monitoring script to egrep multiple words and redirect the output to a text file and its working fine but I want to add some more below given functionality to it, which is very advance and im not very good in it, so please help if you can :) I am egrepping all the... (1 Reply)
Discussion started by: scazed
1 Replies
asadmin-create-jvm-options(1AS) 				   User Commands				   asadmin-create-jvm-options(1AS)

NAME
asadmin-create-jvm-options, create-jvm-options - creates the JVM options from the Java configuration or profiler elements SYNOPSIS
create-jvm-options --user admin_user [--password admin_password][--host localhost] [--port 4848] [--secure|-s] [--passwordfile filename] [--terse=false] [--echo=false] [--interactive=true] [--profiler=false ](jvm_option_name=jvm_option_value)[:jvm_option_name=jvm_option_value]* Creates the JVM options in the Java configuration or Profiler elements of the domain.xml file. You can enter more than one JVM option sepa- rated by a colon (:) . If the JVM option starts with a dash (-) then use two dashes (--) before the operand to distinguish that JVM option is an operand and not an option. JVM options are used to record the settings needed to get a particular profiler going. You must restart the server for the newly created JVM options to take affect. Use the start-domain command to restart the server domain. OPTIONS
--user authorized domain application server administrative username. --password password to administer the domain application server. --host machine name where the domain application server is running. --port port number of the domain application server listening for administration requests. --secure if true, uses SSL/TLS to communicate with the domain application server. --passwordfile file containing the domain application server password. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. --echo setting to true will echo the command line statement on the standard output. Default is false. --interactive if set to true (default), only the required password options are prompted. --profiler indicates if the JVM options is for the profiler. Profiler must exist for this option to be true. OPERANDS
jvm_option_name=jvm_optithevleft side of the equal sign (=) is the JVM option name. The right side of the equal sign (=) is the jvm_option_value. Additionally, you can use ":" as a delimiter for more than one jvm-option. If the jvm-option contains a ":", use the escape character to offset the ":" delimiter. Example 1: Using create-jvm-options asadmin> create-jvm-options --user admin --password adminadmin --host localhost --port 4848 --profiler=false --DDebug=true:"-Xmx256m":" -Dcom.sun.aas.imqBin"="/export/as7se/imq/bin" Command create-jvm-options executed successfully Where the JVM options are created. The double dash (--) is used between --profiler options and the operand because - indicated the end of the options and the following text is the operand. The double dash (--) is necessary here since there are single dashes (i.e., --DDebug) in the operand. To distinguish between the options and the operand, the double dash (--) is used. EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-delete-jvm-options(1AS) J2EE 1.4 SDK March 2004 asadmin-create-jvm-options(1AS)
All times are GMT -4. The time now is 11:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy