Search patterns in multiple logs parallelly.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Search patterns in multiple logs parallelly.
# 15  
Old 01-21-2014
Code:
$ tail log4j.log
2014-01-21 12:31:08,051 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-3] INFO  resourcing.DoubleResourceBundle - No resource bundle found for 'StringTable'
2014-01-21 12:31:08,063 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-3] INFO  resourcing.DoubleResourceBundle - No resource bundle found for 'StringTable'
2014-01-21 12:31:08,077 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-3] INFO  resourcing.DoubleResourceBundle - No resource bundle found for 'StringTable'
2014-01-21 12:31:08,085 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-3] INFO  resourcing.DoubleResourceBundle - No resource bundle found for 'StringTable'
2014-01-21 12:31:12,769 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-2] INFO  xpath.XPathOptimizer - registerInterceptor com.trax.gateway.util.StatusGranularityOptimizer (1)
2014-01-21 12:31:12,774 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-2] INFO  xpath.XPathOptimizer - registerInterceptor com.trax.gateway.util.CreationDateToIDMapper (2)
2014-01-21 12:31:13,053 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-6] INFO  gui.NavigationCachingHelper - Creating instance of NavigationCachingHelper for language 'en'
2014-01-21 12:31:13,087 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-2] INFO  session.CountFromViewStrategy - Initializing MATERIALIZED VIEW (Synchronous) [GTW_TX ==> TMP_GTW_TX_COUNT_MVE]
2014-01-21 12:31:13,097 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-2] INFO  session.CountFromViewStrategy - Initializing MATERIALIZED VIEW (Synchronous) [GTW_WFL_EX ==> TMP_GTW_WFL_EX_COUNT_MVE]
2014-01-21 12:31:25,702 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-4] WARN  impl.CacheManagerImpl - Cache: test.anonymiser.delay not configured, using defaults.
$
$
$ TIME="2014-01-21 12:31:08,087"
$ $AWK -v T="TIME" '{ $0 >= T }' log4j.log
$
$ echo $AWK
/usr/xpg4/bin/awk
$
$ ls -lrt log4j.log
-rw-r--r--   1 mwjbs    mwjbs    1691009 Jan 21 12:31 log4j.log

---------- Post updated at 12:03 AM ---------- Previous update was at 12:02 AM ----------

Whether the problem would be with the permissions of the file??

Last edited by Corona688; 01-21-2014 at 02:44 PM..
# 16  
Old 01-21-2014
The permissions are not a problem, the file is world-readable. It would complain 'permission denied' if it couldn't open the file, anyway.

But, you made a typo. Try this:
Code:
$AWK -v T="$TIME" '$0 >= T' log4j.log

To be specific: You forgot the $, and you added extra { } which changed the meaning of the program. It must be exactly as shown.
# 17  
Old 01-21-2014
sorry for the mistake

But even after correcting the code there was no o/p


Code:
$ tail log4j.log
2014-01-21 12:31:08,051 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-3] INFO  resourcing.DoubleResourceBundle - No resource bundle found for 'StringTable'
2014-01-21 12:31:08,063 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-3] INFO  resourcing.DoubleResourceBundle - No resource bundle found for 'StringTable'
2014-01-21 12:31:08,077 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-3] INFO  resourcing.DoubleResourceBundle - No resource bundle found for 'StringTable'
2014-01-21 12:31:08,085 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-3] INFO  resourcing.DoubleResourceBundle - No resource bundle found for 'StringTable'
2014-01-21 12:31:12,769 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-2] INFO  xpath.XPathOptimizer - registerInterceptor com.trax.gateway.util.StatusGranularityOptimizer (1)
2014-01-21 12:31:12,774 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-2] INFO  xpath.XPathOptimizer - registerInterceptor com.trax.gateway.util.CreationDateToIDMapper (2)
2014-01-21 12:31:13,053 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-6] INFO  gui.NavigationCachingHelper - Creating instance of NavigationCachingHelper for language 'en'
2014-01-21 12:31:13,087 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-2] INFO  session.CountFromViewStrategy - Initializing MATERIALIZED VIEW (Synchronous) [GTW_TX ==> TMP_GTW_TX_COUNT_MVE]
2014-01-21 12:31:13,097 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-2] INFO  session.CountFromViewStrategy - Initializing MATERIALIZED VIEW (Synchronous) [GTW_WFL_EX ==> TMP_GTW_WFL_EX_COUNT_MVE]
2014-01-21 12:31:25,702 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-4] WARN  impl.CacheManagerImpl - Cache: test.anonymiser.delay not configured, using defaults.
$
$ TIME="2014-01-21 12:31:08,087"
$
$ echo $TIME
2014-01-21 12:31:08,087
$ $AWK -v T="$TIME" '{ $0 >= T }' log4j.log
$
$

Moderator's Comments:
Mod Comment Code tags for code, PLEASE!
# 18  
Old 01-21-2014
You still changed it. You added extra { } which completely altered the meaning of the program. That could have been my fault -- I tend to edit my posts 3 or 4 times after posting, you might have seen a less-than-final version.

Copy and paste this, letter-for-letter:

Code:
$AWK -v T="$TIME" '$0 >= T' log4j.log

# 19  
Old 01-21-2014
yes it is working but along with the required output some extra output is also comming. can you please advide on that


Code:
env: LD_LIBRARY_PATH=/apps/java/jdk1.6.0_31/jre/lib/sparcv9/server:/apps/java/jdk1.6.0_31/jre/lib/sparcv9:/apps/java/jdk1.6.0_31/jre/../lib/sparcv9:/opt/CA/SharedComponents/ETPKI/../lib:/opt/CA/SharedComponents/lib:/opt/CA/CAlib:/usr/lib:/opt/CA/SharedComponents/Csam/SockAdapter/lib
env: SHELL=/bin/bash
env: PATH=/opt/boksm/bin:/bin:/sbin:/usr/sbin:/usr/ucb:/usr/openwin/bin:/opt/CA/SharedComponents/bin
env: JBOSS_HOME=/apps/jboss/jboss-eap-5.1/jboss-as
env: CABIN=/opt/CA/SharedComponents/bin
env: HOME=/opt/home/mwjbs
env: CSAM_SOCKADAPTER=/opt/CA/SharedComponents/Csam/SockAdapter
env: CASHCOMP=/opt/CA/SharedComponents
env: CSAM_LOGGER_CONF=/opt/CA/SharedComponents/Csam/SockAdapter/cfg/logger.cfg
env: A__z="*TMOUT
env: CA_CAILANGUAGE=enu
env: TZ=EST5EDT
===============================
javax.ejb.EJBException: RuntimeException
Caused by: com.trax.framework.exceptions.GeneralFailureException: com.trax.framework.license.LicenseCheckException: Invalid subsystem MODEL-RMAManagement defined
Caused by: com.trax.framework.license.LicenseCheckException: Invalid subsystem MODEL-RMAManagement defined
javax.ejb.EJBException: RuntimeException
Caused by: com.trax.framework.exceptions.GeneralFailureException: com.trax.framework.license.LicenseCheckException: Invalid subsystem MODEL-RMAManagement defined
Caused by: com.trax.framework.license.LicenseCheckException: Invalid subsystem MODEL-RMAManagement defined
com.trax.framework.exceptions.GeneralFailureException: com.trax.framework.license.LicenseCheckException: Invalid subsystem MODEL-RMAManagement defined
Caused by: com.trax.framework.license.LicenseCheckException: Invalid subsystem MODEL-RMAManagement defined
com.trax.framework.exceptions.RuleEngineException: com.trax.framework.license.LicenseCheckException: Invalid subsystem MODEL-RMAManagement defined, in rule: 'logical-node-recover'[6/6]/'recover-authorizations' (160:com.trax.rma.management.rules.RecoverAuthorizationsRule)
com.trax.framework.thread.ExecutionException: javax.ejb.EJBException: java.rmi.RemoteException: exception wile executing command; nested exception is:
Caused by: javax.ejb.EJBException: java.rmi.RemoteException: exception wile executing command; nested exception is:
Caused by: java.rmi.RemoteException: exception wile executing command; nested exception is:
Caused by: com.trax.framework.thread.ExecutionException: com.trax.framework.exceptions.RuleEngineException: com.trax.framework.license.LicenseCheckException: Invalid subsystem MODEL-RMAManagement defined, in rule: 'logical-node-recover'[6/6]/'recover-authorizations' (160:com.trax.rma.management.rules.RecoverAuthorizationsRule)
Caused by: com.trax.framework.exceptions.RuleEngineException: com.trax.framework.license.LicenseCheckException: Invalid subsystem MODEL-RMAManagement defined, in rule: 'logical-node-recover'[6/6]/'recover-authorizations' (160:com.trax.rma.management.rules.RecoverAuthorizationsRule)
2014-01-21 12:31:12,769 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-2] INFO  xpath.XPathOptimizer - registerInterceptor com.trax.gateway.util.StatusGranularityOptimizer (1)
2014-01-21 12:31:12,774 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-2] INFO  xpath.XPathOptimizer - registerInterceptor com.trax.gateway.util.CreationDateToIDMapper (2)
2014-01-21 12:31:13,053 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-6] INFO  gui.NavigationCachingHelper - Creating instance of NavigationCachingHelper for language 'en'
2014-01-21 12:31:13,087 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-2] INFO  session.CountFromViewStrategy - Initializing MATERIALIZED VIEW (Synchronous) [GTW_TX ==> TMP_GTW_TX_COUNT_MVE]
2014-01-21 12:31:13,097 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-2] INFO  session.CountFromViewStrategy - Initializing MATERIALIZED VIEW (Synchronous) [GTW_WFL_EX ==> TMP_GTW_WFL_EX_COUNT_MVE]
2014-01-21 12:31:25,702 [http-wspsa99a0036.wellsfargo.com%2F167.138.101.48-6443-4] WARN  impl.CacheManagerImpl - Cache: test.anonymiser.delay not configured, using defaults.


Last edited by Corona688; 01-21-2014 at 03:35 PM..
# 20  
Old 01-21-2014
If you don't start wrapping your code in code tags you will receive infractions. That's at least four posts of yours I've had to fix.

I can't tell where that output is coming from because I don't know what your input is. Try $AWK -v T="$TIME" '/^[0-9][0-9][0-9][0-9]/ && ($0 >= T)' log4j.log but if that doesn't work post your input. I am not a mind reader.
This User Gave Thanks to Corona688 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search Multiple patterns and display

Hi, I have scenario like below and need to search for multiple patterns Eg: Test Time Started= secs Time Ended = secc Green test Test Time Started= secs Time Ended = secc Green test Output: I need to display the text starting with Test and starting with Time... (2 Replies)
Discussion started by: weknowd
2 Replies

2. Shell Programming and Scripting

Search and replace multiple patterns in a particular column only - efficient script

Hi Bigshots, I have a pattern file with two columns. I have another data file. If column 1 in the pattern file appears as the 4th column in the data file, I need to replace it (4th column of data file) with column 2 of the pattern file. If the pattern is found in any other column, it should not... (6 Replies)
Discussion started by: ss112233
6 Replies

3. Shell Programming and Scripting

How to search multiple patterns and remove lines from a file?

Hi, I have a file content as below. Table : PAYR Displayed fields: 15 of 15 Fixed columns: 4 List width 0999... (4 Replies)
Discussion started by: shirdi
4 Replies

4. Shell Programming and Scripting

How to search Multiple patterns in unix

Hi, I tried to search multiple pattern using awk trans=1234 reason=LN MISMATCH rec=`awk '/$trans/ && /'"$reason"'/' file` whenevr i tried to run on command promt it is executing but when i tried to implment same logic in shell script,it is failing i.e $rec is empty ... (6 Replies)
Discussion started by: ns64110
6 Replies

5. Shell Programming and Scripting

awk: Multiple search patterns & print in an one liner

I would like to print result of multiple search pattern invoked from an one liner. The code looks like this but won't work gawk -F '{{if ($0 ~ /pattern1/) pat1=$1 && if ($0 ~ /pattern2/) pat2=$2} ; print pat1, pat2}' Can anybody help getting the right code? (10 Replies)
Discussion started by: sdf
10 Replies

6. Shell Programming and Scripting

search multiple patterns

I have two lists in a file that look like a b b a e f c d f e d c I would like a final list a b c d e f I've tried multiple grep and awk but can't get it to work (8 Replies)
Discussion started by: godzilla07
8 Replies

7. Shell Programming and Scripting

Search multiple patterns in multiple files

Hi, I have to write one script that has to search a list of numbers in certain zipped files. For eg. one file file1.txt contains the numbers. File1.txt contains 5,00,000 numbers and I have to search each number in zipped files(The number of zipped files are around 1000 each file is 5 MB) I have... (10 Replies)
Discussion started by: vsachan
10 Replies

8. Shell Programming and Scripting

Perl - How to search a text file with multiple patterns?

Good day, great gurus, I'm new to Perl, and programming in general. I'm trying to retrieve a column of data from my text file which spans a non-specific number of lines. So I did a regexp that will pick out the columns. However,my pattern would vary. I tried using a foreach loop unsuccessfully.... (2 Replies)
Discussion started by: Sp3ck
2 Replies

9. Shell Programming and Scripting

Perl: Match a line with multiple search patterns

Hi I'm not very good with the serach patterns and I'd need a sample how to find a line that has multiple patterns. Say I want to find a line that has "abd", "123" and "QWERTY" and there can be any characters or numbers between the serach patterns, I have a file that has thousands of lines and... (10 Replies)
Discussion started by: Juha
10 Replies

10. UNIX for Dummies Questions & Answers

How to parameterize multiple search patterns and generate a new file

I have one file: 123*100*abcd*10 123*101*abcd*-29*def 123*100*abcd*-10 123*102*abcd*-105*asd I would like to parameterize the search patterns in the following way so that the user could dynamically change the search pattern. *100* and *- (ie *minus) *102* and *- The output that is... (6 Replies)
Discussion started by: augustinep
6 Replies
Login or Register to Ask a Question