Informix

Informix

Connect with Db2, Informix, Netezza, open source, and other data experts to gain value from your data, share insights, and solve problems.

 View Only
Expand all | Collapse all

Purge informix log file

  • 1.  Purge informix log file

    Posted Tue September 23, 2025 01:36 AM

    Hi Experts,

    Our informix log file (which outputs from onstat -m or  MSGPATH parameter in onconfig) isn't purged since years &7 has grown in size. Please help how to purge this file & does this requires shutdown. Any risk to DB if done in improper way?

    Thanks in advance

    Syed H



    ------------------------------
    Syed Hussaini
    ------------------------------


  • 2.  RE: Purge informix log file

    Posted Tue September 23, 2025 04:51 AM
    Hi Syed

    You can of course clean up you message log file any time you want without affecting your engine.
    No need to shutdown.





  • 3.  RE: Purge informix log file

    Posted Tue September 23, 2025 06:49 AM
    Just use logrotate, 


    Cheers
    Paul

    Paul Watson
    Oninit LLC
    +1-913-387-7529
    www.oninit.com
    Oninit®️ is a registered trademark of Oninit LLC





  • 4.  RE: Purge informix log file

    Posted Tue September 23, 2025 06:53 AM

    EXECUTE FUNCTION task("message log rotate", "/usr/informix/online.log", 31);

     

    Where 31 is as example of max versions of archived online.log.

     

     






  • 5.  RE: Purge informix log file

    Posted Wed September 24, 2025 09:04 PM

    Syed:

    You can set up message log rotation, specifying the number of older copies to keep and how frequently to create a new log file in the engine. You can also set up a cron job to do that using OS features. Finally you can just rename the file or delete it and Informix will just create a new one the next time it has to wrote to the message log. 

    Art



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 6.  RE: Purge informix log file

    Posted Sat September 27, 2025 02:40 AM

    Thank you all for the wonderful suggestions & will definitely try out those in non-prod environment. Meanwhile, I find the below suggestion from chatgpt on this topic. Please let me know if this also works.

    mv $INFORMIXDIR/tmp/online.log $INFORMIXDIR/tmp/online.log.old
    touch $INFORMIXDIR/tmp/online.log
    chmod 660 $INFORMIXDIR/tmp/online.log

    Thanks again.



    ------------------------------
    Syed Hussaini
    ------------------------------



  • 7.  RE: Purge informix log file

    Posted Sat September 27, 2025 04:56 AM

    Hi Syed,

    This solution will not work a 100%.

    What you are doing is this script is copying the online.log file to a backup online.log.old file and then updating the access and modification times to the file online.log without emptying it.

    What you should do is rm (remove) the online.log file before the touch command. However are you sure that your log file (commonly named online.log) is really named online.log. Make sure that the real log file (check using onstat -m or MSGPATH in the onconfig file) is the file that you are working on and replace $INFORMIXDIR/tmp/online.log  by the real name (found using onstat -m) of your messages log file in this script.

    Hope that this helps

    Cordialement, Regards,    Khaled Bentebal Directeur Général - ConsultiX Tél: 33 (0) 1 39 12 18 00 Mobile: 33 (0) 6 07 78 41 97 Email: khaled.bentebal@consult-ix.fr Site Web:  www.consult-ix.fr
    Le 27/09/2025 à 08:40, Syed Hussaini via IBM TechXchange Community a écrit :
    0100019989e665bf-a841df25-dde9-48c9-9cbd-b7b74c53bb42-000000@email.amazonses.com">
    Thank you all for the wonderful suggestions & will definitely try out those in non-prod environment. Meanwhile, I find the below suggestion from...





  • 8.  RE: Purge informix log file

    Posted Sat September 27, 2025 05:04 AM

    Syed,

    What I would also suggest is to keep the messages activity for the last month or 2 months available in the messages log file in order to be able to go back up and check things if needed. Of course, the information is available in the backup (.old file) if you need it but sometimes it is handy to have the information available in the same file. Of course this is just for you and does not affect the engine in any way.

    Cordialement, Regards,    Khaled Bentebal Directeur Général - ConsultiX Tél: 33 (0) 1 39 12 18 00 Mobile: 33 (0) 6 07 78 41 97 Email: khaled.bentebal@consult-ix.fr Site Web:  www.consult-ix.fr
    Le 27/09/2025 à 10:56, khaled Bentebal via IBM TechXchange Community a écrit :
    010001998a630b21-024039aa-659b-44ca-a557-3fdbe94a51ae-000000@email.amazonses.com">
    Hi Syed, This solution will not work a 100%. What you are doing is this script is copying the online.log file to a backup online... -posted to the "Informix" group





  • 9.  RE: Purge informix log file

    Posted Sat September 27, 2025 05:29 AM

    You may also copy the file to another name and then after, zerorized the files content as follows:

    1. cp /Informix/tmp/online.log to /informix/tmp/online.log.old
    2. cat /dev/null > /informix/tmp/online.log

    the .old version may be removed later as a housekeeping exercise when no more needed.

    mv the file to .old and re-create it later might result the log entries having nowhere to write to in the interval (the gap between mv and touch command).

    Nevertheless, the best auto-upkeep is to configure for the message-log-file-rotation feature to be in place.



    ------------------------------
    fauziah ayob
    ------------------------------



  • 10.  RE: Purge informix log file

    Posted Sat September 27, 2025 08:34 PM

    Syed:

    Yes that will work. See Khaled's notes as well about the name of the file though. 

    You can zip the old file after you rename it or just delete it as Khaled suggested. 

    Settingbuo some kind of log rotation say monthly, saving one to three older copies is the long term solution however.

    Art



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 11.  RE: Purge informix log file

    Posted Mon September 29, 2025 09:41 AM

    The rename (mv) alone should do.  The next message created by the server will automatically re-create the file.



    ------------------------------
    Andreas Legner
    Informix Dev
    HCL Software
    ------------------------------



  • 12.  RE: Purge informix log file

    Posted Mon September 29, 2025 10:21 AM

    Hello Andreas,

     

    Does not engine remember  opened file descriptor of renamed online.log and continue writing messages into it, the same problem with deleting file?

    We are using

    cat online.log|gz ...

    and then

    cat /dev/null >online.log

     

    Milan Rafaj

    Senior Lead, Infrastructure/Cloud Architecture

    Kyndryl Consult

    +420 737 264 248

    www.kyndryl.cz

     

    Planned absence/Plánovaná nepřítomnost: 22-26.9., 1-3.10.2025

     

    Kyndryl Česká republika, spol. s r. o.

    Sídlo: Praha 4, Chodov, V Parku 2308/8, PSČ: 148 00,

    IČ: 14890992

    Zapsaná v obchodním rejstříku, vedeném Městským soudem v Praze (oddíl C, vložka 339277)

    Registered address: Prague 4, Chodov, V Parku, 2308/8, Zip code: 148 00

    Company ID: 14890992

    Entered in the Commercial Register maintained by the Municipal Court in Prague (Part C, Entry 339277)

     






  • 13.  RE: Purge informix log file

    Posted Mon September 29, 2025 10:31 AM

    Milan:

    No, the engine does not keep the message log open, it opens the log, writes a message, then closes the log file.

    It is, as Andreas stated, and I had implied in an earlier post, only necessary to rename or delete the current message log file and the engine will just create a new one. Witness:

    informix@Gandolf:~$ ls -l /opt/informix/infmx/tmp/online.elendil.log*
    -rw-rw-r-- 1 informix informix 1107167 Sep 29 10:26 /opt/informix/infmx/tmp/online.elendil.log
    informix@Gandolf:~$ mv /opt/informix/infmx/tmp/online.elendil.log /opt/informix/infmx/tmp/online.elendil.log.1
    informix@Gandolf:~$ onmode -c
    informix@Gandolf:~$ dir /opt/informix/infmx/tmp/online.elendil.log
    -rw-rw-r-- 1 informix informix 361 Sep 29 10:28 /opt/informix/infmx/tmp/online.elendil.log
    informix@Gandolf:~$ cat /opt/informix/infmx/tmp/online.elendil.log
    09/29/2025 10:28:51   Checkpoint Completed:  duration was 0 seconds.
    09/29/2025 10:28:51   Mon Sep 29 - loguniq 4106, logpos 0x76e020, timestamp: 0x11db153da Interval: 23481 Phypos 0xbe9fa
     
    09/29/2025 10:28:51   Maximum server connections 0
    09/29/2025 10:28:51   Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 92, Llog used 174

    Art



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 14.  RE: Purge informix log file

    Posted Mon September 29, 2025 10:46 AM

    Thank you Art for clarification

     

    Milan Rafaj

    Senior Lead, Infrastructure/Cloud Architecture

    Kyndryl Consult

    +420 737 264 248

    www.kyndryl.cz

     

    Planned absence/Plánovaná nepřítomnost: 22-26.9., 1-3.10.2025

     

    Kyndryl Česká republika, spol. s r. o.

    Sídlo: Praha 4, Chodov, V Parku 2308/8, PSČ: 148 00,

    IČ: 14890992

    Zapsaná v obchodním rejstříku, vedeném Městským soudem v Praze (oddíl C, vložka 339277)

    Registered address: Prague 4, Chodov, V Parku, 2308/8, Zip code: 148 00

    Company ID: 14890992

    Entered in the Commercial Register maintained by the Municipal Court in Prague (Part C, Entry 339277)

     






  • 15.  RE: Purge informix log file

    Posted Tue September 30, 2025 08:55 AM
    There is (was) an undoc library call, that I can just not remember at the moment, you can wrap in a UDR and write to the online.log via SQL

    Cheers
    Paul

    On 9/29/2025 9:45 AM, Milan Rafaj via IBM TechXchange Community wrote:
    0100019995efcc6e-ad88ce8e-91c2-4edc-883b-adb824167392-000000@email.amazonses.com">
    Thank you Art for clarification Milan Rafaj Senior Lead, Infrastructure/Cloud Architecture Kyndryl Consult +420 737 264 248 www.kyndryl... -posted to the "Informix" group