AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
  • 1.  Splitting a redirecting log file in IBM AIX - need UNIX command

    Posted Fri April 02, 2010 07:45 AM

    Originally posted by: k10k


    Hello Forumers
    I have a weblogic application s/w installed in IBM AIX machine.
    I have a sample weblogic shell script that executes a Oracle weblogic command(process) which is in nohup(background process) and redirected to a log file. The log file being redirected should get changed for every say 10mb i.e the nohup weblogic process being executed in back ground should redirect to file(s) for every 100 mb in size. The redirection should be in nohup. The weblogic process should not be killed or stopped while the redirection is happening.

    i provide a sample shell script


    #!/bin/sh
    1. WARNING: This file is created by the Configuration Wizard.
    2. Any changes to this script may be lost when adding extensions to this configuration.

    DOMAIN_HOME="/usr/local/bea/user_projects/domains/ebwdomain"
    rm /ibankapp/ibs/ebw.txt
    nohup ${DOMAIN_HOME}/bin/startWebLogic.sh $* > /ibankapp/ibs/ebw.txt &


    statWeblogic.sh is the command being executed in background which is redirecting to ebw.txt. The redirection should take place to a new file after every 100 mb.

    This ebw.txt will be in gb size that is why i wanted an answer for this

    Thanks Forum
    K@RtHiK


  • 2.  Re: Splitting a redirecting log file in IBM AIX - need UNIX command

    Posted Fri April 02, 2010 08:24 AM

    Originally posted by: cd3lgado


    Hi

    You can use the logrotate program

    http://www.perzl.org/aix/index.php?n=Main.Logrotate

    Hope this helps


  • 3.  Re: Splitting a redirecting log file in IBM AIX - need UNIX command

    Posted Fri April 02, 2010 11:10 AM

    Originally posted by: k10k


    hi
    Will "logrotate" utility help in splitting a file that is currently running in background?
    And will that utility while splitting will reduce the size of current file that is getting redirected?

    Pls explain about this utility

    Other than this utility can there be any changes in script level.

    From
    k@RtHiK


  • 4.  Re: Splitting a redirecting log file in IBM AIX - need UNIX command

    Posted Fri April 02, 2010 11:09 AM

    Originally posted by: k10k


    hi
    Will "logrotate" utility help in splitting a file that is currently running in background?
    And will that utility while splitting will reduce the size of current file that is getting redirected?

    Pls explain about this utility

    Other than this utility can there be any changes in script level.

    From
    k@RtHiK


  • 5.  Re: Splitting a redirecting log file in IBM AIX - need UNIX command

    Posted Fri April 02, 2010 11:48 AM

    Originally posted by: cd3lgado


    Hi

    Yes, it will split the log file currently opened for a given active process. The configuration file let you run a given script that can restart your application just after log file has been split and run. This last could be a limitation cause your application has to be able to support a restart with no problems.


  • 6.  Re: Splitting a redirecting log file in IBM AIX - need UNIX command

    Posted Mon April 05, 2010 07:20 AM

    Originally posted by: k10k


    hi
    I have enterprised application deployed in the production. This application is for banking services through online like internet banking etc. Is there any possibility other than restart as i feel it is production and massive hits will be round the clock (24*7).Generally the application will be restarted when there is any upgradation of OS in the server or any enhancement done in the deployed application etc. Frequent restarts will not be recommended by the Clients as it dealts with finance business.

    Please provide any other possibility.


  • 7.  Re: Splitting a redirecting log file in IBM AIX - need UNIX command

    Posted Tue April 06, 2010 12:24 PM

    Originally posted by: flodstrom


    You could also use the system log facility for this. In theory the AIX syslog can do all that you want to acomplish, but the problem might be in how to get it to log to the syslog? The amount of logging you seem to have may also be an issue?

    Best would be if your application have native support for syslog, does it have that?

    If the application does not have native support you could try with something like the following.

    First instead of redirecting the output to a file, pipe it to the logger command. For example.

    ...WebLogic.sh $* | logger -plocal3.info

    However, before you do this you should first set-up all the filters and rules for the syslog, especially for the "local3" facility (or whatever facility you choose). For example you probably don't want to flood the normal system log with the output of your application. An example config for the syslog (first line is default AIX6.1 entry with "local3.none" added):

    *.debug;local3.none /var/log/aix/console.log rotate size 1M files 4
    local3.debug /ibankapp/ibs/ebw.log rotate size 100M files 10

    This would save 10 log files of 100MB each before the oldest one is deleted. Also, the normal system log would not receive any output from your application.

    In your case you might even want to use the compress and archive functions, see the manpage for syslog.conf for more.

    One thing though. I have never used the syslog to the scale of your problem so you have to test this first to see if it will fit your needs, or if it will even work. Use the logger command manually to see how it looks like and test the filters at the same time.

    Just be carefull in case you manually manipulate active log files, you may have to "kill -HUP" the syslogd in order to resume logging. I think the same goes for changing/updating filter rules.


  • 8.  Re: Splitting a redirecting log file in IBM AIX - need UNIX command

    Posted Tue April 06, 2010 12:43 PM

    Originally posted by: Casey_B


    The answer is that you need to talk to WebLogic. (Or I guess it is Oracle...)

    Many Un*x style daemons accept some form of signal to
    cycle log files, or to reopen log files without restarting the whole application.

    But that doesn't mean that your particular application will.

    Another option is to see if you can get WebLogic to send it's log output
    to syslog. In that case, there are non-intrusive logging options
    that syslog can do.

    (Look in /etc/syslog.conf for examples)

    But again, that is dependent on your application being able to send logs
    to syslog.

    Hope this helps,
    Casey