WebSphere Application Server & Liberty

WebSphere Application Server & Liberty

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Checking logs- Need useful commands

    Posted 10/01/13 04:45 PM
    Hi,

    I only know this command to search logs for a particular string.

    grep -n -i 'string'

    Can someone please give me some useful commands to search application, systemout nodeagent logs affectively in day to day activities.

    I searched everywhere but couldnt find any article describing effectively on commands

    Thanks
    Anil


  • 2.  Checking logs- Need useful commands

    Posted 10/02/13 05:55 AM
    grep -in

    sed -n ',p'   |more


    Example:
    [root@HOSTNAME~]#grep -in  error SystemOut.log
    18993:[9/4/13 8:11:17:570 GST] 00000020 ServerCache E DYNA1082E: WebSphere error1
    19170:[9/4/13 8:11:17:570 GST] 00000020 ServerCache E DYNA1082E: WebSphere error1
    [root@HOSTNAME~]#
    [root@HOSTNAME~]#
    [root@HOSTNAME~]#sed -n '18993, 19000p' SystemOut.log|more
     
    Note:
    The first command (grep)gives you the line numbers with patterns found in the file
    In second command provide a start and end line number based on the output of the first command. ensure to put the letter "p" after the end line number.

    You can either redirect it to a file using ">" redirective or through more command on the console.

    Thanks
    CB


  • 3.  Checking logs- Need useful commands

    Posted 10/02/13 06:15 AM
    Thank you siby for the reply..

    But im using the grep -n -i '' and sed command as of now. Please let me know if there is any command to search between times and dates.

    Ex- 9/4/13 8:11:17:570 to 9/4/13 8:20:17:570

    Thanks in advance
    Anil


  • 4.  Checking logs- Need useful commands

    Posted 10/02/13 06:36 AM
    You may try awk instead...

    Example:

    #awk '/10\/1\/13/{p=1} /10\/2\/13/{p=0}p' SystemOut.log |more


    Here I have used "" as the delimiter. If your dates does not have symbols, you may try 

    #awk '/01 Oct 2013/{p=1} /02 Oct 2013/{p=0} p'  SystemOut.log |more


    Thanks
    CB