grep -w E
Hello All,
We are getting many messages in the log file. There are many types of messages, i.e. W for warning, E for error etc, We wanted to grep errors contain only error type "E". If I grep E it is greping all words which has letter E. I trid to do below command but its getting repeating values. grep -w E SystemOut.log | sort | uniq >> sysfinal2 Please help me for the write command. thanks |
You can replace
Code:
sort | uniq Code:
sort -u |
grep -w E SystemOut.log | sort -u >> sysfinal2
I am getting repaeting values (only time stamps is different) Here is one of the message: [2/6/10 9:38:24:485 PST] 00000012 WSRdbXaResour E DSRA0302E: XAException occurred. Error code is: XA_RBOTHER (104). Exception is: <null> [2/6/10 9:39:04:505 PST] 00000012 WSRdbXaResour E DSRA0302E: XAException occurred. Error code is: XA_RBOTHER (104). Exception is: <null> thanks |
Try grepping for " E " instead of just "E" - i.e. space E space in quotes.
|
Quote:
grep -w " E " SystemOut.log sort -u >> sysfinal3 grep: sort: No such file or directory ------------------------------ grep -w " E " SystemOut.log >> sysfinal3 size of the file is zero. |
grep -w " A " SystemOut.log | sort | uniq >> sysfinal3
>cat sysfinal3 [2/6/10 9:39:15:007 PST] 0000aa21 AdminHelper A ADMN1020I: An attempt is made to stop the WebSphere_Portal server. (User ID = defaultWIMFileBasedRealm/admin) This is the very first “ A “ type message in the SystemOut.log But there are many more A types. here are some of: [2/6/10 9:39:20:439 PST] 00000012 ApplicationMg A WSVR0217I: Stopping application: Personalization_Workspace_6 [2/6/10 9:39:23:857 PST] 00000012 ApplicationMg A WSVR0220I: Application stopped: Personalization_Workspace_6 [2/6/10 9:39:23:859 PST] 00000012 ApplicationMg A WSVR0217I: Stopping application: PA_TplApp [2/6/10 9:39:24:970 PST] 00000012 ApplicationMg A WSVR0220I: Application stopped: PA_TplApp [2/6/10 9:39:24:971 PST] 00000012 ApplicationMg A WSVR0217I: Stopping application: PA_DynamicUIApp [2/6/10 9:39:25:420 PST] 00000012 ApplicationMg A WSVR0220I: Application stopped: PA_DynamicUIApp [2/6/10 9:39:25:421 PST] 00000012 ApplicationMg A WSVR0217I: Stopping application: PA_WCM_Admin [2/6/10 9:39:26:520 PST] 00000012 ApplicationMg A WSVR0220I: Application stopped: PA_WCM_Admin [2/6/10 9:39:26:521 PST] 00000012 ApplicationMg A WSVR0217I: Stopping application: PA_WCMLocalRendering [2/6/10 9:39:27:869 PST] 00000012 ApplicationMg A WSVR0220I: Application stopped: PA_WCMLocalRendering [2/6/10 9:39:27:870 PST] 00000012 ApplicationMg A WSVR0217I: Stopping application: PA_WCM_Authoring_UI [2/6/10 9:39:29:225 PST] 00000012 ApplicationMg A WSVR0220I: Application stopped: PA_WCM_Authoring_UI [2/6/10 9:39:29:226 PST] 00000012 ApplicationMg A WSVR0217I: Stopping application: PA_Resource_Manager [2/6/10 9:39:30:410 PST] 00000012 ApplicationMg A WSVR0220I: Application stopped: PA_Resource_Manager [2/6/10 9:39:30:412 PST] 00000012 ApplicationMg A WSVR0217I: Stopping application: PA_Login_Portlet_App Thanks |
Sorry I gave you a silly answer before. The -w option in grep does what I was trying to do with " E ", and I didn't properly grasp your problem.
Try this command:- Code:
grep -w E SystemOut.log | sort | uniq -f 3 |
Quote:
If I need to track multiple types. On above command we are considering only E types but may be want W types too. What to do? Thanks |
Thanks.
This works grep -w E SystemOut.log | sort | uniq -f 3 1) If I like to add more message types as below: grep -w E A W SystemOut.log | sort | uniq -f 3 will it work? 2) Can I add total quantity of error on the same output? LdapRegistryI A SECJ0419I: The user registry is currently connected to the LDAP server ldap: Total Appearance = 10 In SystemOut.log this message appeared 10 times. D |
Quote:
Quote:
|
Code:
grep -w [EAW] |
To count the number of error and warnings (in total), you could do this:-
Code:
CountErrors=$(grep -w E SystemOut.log | wc -l) |
Quote:
thanks i will check monday morning usa (pst) time. Many Thanks |
Uniq string is not working for for the multiple values
> grep -w [AI] SystemOut.log | sort | uniq -f 3 [3/29/10 0:01:45:464 PDT] 00000093 LdapRegistryI A SECJ0419I: The user registry is currently connected to the LDAP server ldap://00.00.00.00:123. [3/29/10 5:00:10:117 PDT] 000000a0 CacheServiceI I DYNA1001I: WebSphere Dynamic Cache instance named services/cache/iwk/abspath initialized successfully. [3/29/10 5:00:10:180 PDT] 000000a0 CacheServiceI I DYNA1001I: WebSphere Dynamic Cache instance named services/cache/iwk/abspathreverse initialized successfully. [3/29/10 5:00:35:120 PDT] 0000009f CacheServiceI I DYNA1001I: WebSphere Dynamic Cache instance named services/cache/iwk/menu initialized successfully. [3/29/10 5:01:46:113 PDT] 00000093 LdapRegistryI A SECJ0419I: The user registry is currently connected to the LDAP server ldap://00.00.00.00:123. dn@dev2:/opt/IBM/WebSphere/PortalServer/log> |
I have noticed that single string is not working too.
> grep -w E SystemOut.log | sort | uniq -f 3 [3/29/10 5:37:32:540 PDT] 000000fe ServletWrappe E SRVE0068E: Could not invoke the service() method on servlet /jsp/index.jsp. Exception thrown : java.lang.NullPointerException [3/29/10 7:03:14:566 PDT] 00000101 ServletWrappe E SRVE0068E: Could not invoke the service() method on servlet /jsp/index.jsp. Exception thrown : java.lang.NullPointerException [3/29/10 7:13:30:308 PDT] 00000120 ServletWrappe E SRVE0068E: Could not invoke the service() method on servlet /jsp/index.jsp. Exception thrown : java.lang.NullPointerException [3/29/10 5:37:32:599 PDT] 000000fe ServletWrappe E SRVE0068E: Could not invoke the service() method on servlet AutonomyJSPPortlet. Exception thrown : javax.servlet.ServletException [3/29/10 8:02:01:636 PDT] 00000124 ServletWrappe E SRVE0068E: Could not invoke the service() method on servlet AutonomyJSPPortlet. Exception thrown : javax.servlet.ServletException: [3/29/10 7:13:30:335 PDT] 00000120 ServletWrappe E SRVE0068E: Could not invoke the service() method on servlet AutonomyJSPPortlet. Exception thrown : javax.servlet.ServletException [3/29/10 7:03:14:586 PDT] 00000101 ServletWrappe E SRVE0068E: Could not invoke the service() method on servlet AutonomyJSPPortlet. Exception thrown : javax.servlet.ServletException [3/29/10 8:02:01:618 PDT] 00000124 ServletWrappe E SRVE0068E: Could not invoke the service() method on servlet /jsp/007recentInformation.jsp. Exception thrown : javax.servlet.ServletException: A required [3/29/10 5:37:32:652 PDT] 000000fe ServletWrappe E SRVE0014E: Uncaught service() exception root cause AutonomyJSPPortlet: java.lang.NullPointerException [3/29/10 7:13:30:358 PDT] 00000120 ServletWrappe E SRVE0014E: Uncaught service() exception root cause AutonomyJSPPortlet: java.lang.NullPointerException [3/29/10 7:03:14:606 PDT] 00000101 ServletWrappe E SRVE0014E: Uncaught service() exception root cause AutonomyJSPPortlet: java.lang.NullPointerException [3/29/10 8:02:01:629 PDT] 00000124 ServletWrappe E SRVE0014E: Uncaught service() exception root cause /jsp/007recentInformation.jsp: com.autonomy.aci.exceptions.MissingParameterException: A required [3/29/10 8:02:01:643 PDT] 00000124 ServletWrappe E SRVE0014E: Uncaught service() exception root cause AutonomyJSPPortlet: javax.portlet.PortletException: [3/29/10 2:19:24:510 PDT] 00000104 PortletRender E com.ibm.wps.engine.tags.PortletRenderTag doStartTag EJPEJ0066E: The portlet could not be rendered. [3/29/10 5:37:32:700 PDT] 000000fe PortletRender E com.ibm.wps.engine.tags.PortletRenderTag doStartTag EJPEJ0066E: The portlet could not be rendered. [3/29/10 7:03:14:624 PDT] 00000101 PortletRender E com.ibm.wps.engine.tags.PortletRenderTag doStartTag EJPEJ0066E: The portlet could not be rendered. [3/29/10 7:13:30:372 PDT] 00000120 PortletRender E com.ibm.wps.engine.tags.PortletRenderTag doStartTag EJPEJ0066E: The portlet could not be rendered. [3/29/10 3:03:16:239 PDT] 00000103 RepositorySer E Requested object could not be found. [3/29/10 3:03:16:298 PDT] 00000101 RepositorySer E Requested object could not be found. [3/29/10 5:28:25:269 PDT] 00000122 RepositorySer E Requested object could not be found. [3/29/10 5:37:32:596 PDT] 000000fe LocalTranCoor E WLTC0017E: Resources rolled back due to setRollbackOnly() being called. [3/29/10 7:03:14:584 PDT] 00000101 LocalTranCoor E WLTC0017E: Resources rolled back due to setRollbackOnly() being called. [3/29/10 7:13:30:333 PDT] 00000120 LocalTranCoor E WLTC0017E: Resources rolled back due to setRollbackOnly() being called. |
All times are GMT -5. The time now is 03:24 AM. |