• Home
  • Services
    • HR Services
      • HR Advisory Services
      • Contract Staffing
      • HR Outsourcing Services
      • Manpower Supply Services
      • Payroll Processing
      • Permanent Placement
      • Recruitment and Placement Services
      • Recruitment Process Outsourcing
      • Staffing Agency Services
    • DBA Support
      • DBA Consultancy Services
      • PostgreSQL Support
    • Website Maintenance
    • Company Registration Services
    • Virtual Office Space Address
  • Company
    • FAQs
    • About Us
    • Contact
  • Locations
  • Blogs
    • Blog
    • Blog – PostgreSQL Support
    • Blog – PostgreSQL Migration
    • Blog – All DB’s
    • Blog – Linux
  • Courses

    About Courses

    • List Of Courses
    • Become an Instructor
    Greenplum

    Greenplum

    $1,500.00
    Read More
    Have any question?
    (+91)8838953252
    ITsupport@rayafeel.com
    Login
    RayaFeeL
    • Home
    • Services
      • HR Services
        • HR Advisory Services
        • Contract Staffing
        • HR Outsourcing Services
        • Manpower Supply Services
        • Payroll Processing
        • Permanent Placement
        • Recruitment and Placement Services
        • Recruitment Process Outsourcing
        • Staffing Agency Services
      • DBA Support
        • DBA Consultancy Services
        • PostgreSQL Support
      • Website Maintenance
      • Company Registration Services
      • Virtual Office Space Address
    • Company
      • FAQs
      • About Us
      • Contact
    • Locations
    • Blogs
      • Blog
      • Blog – PostgreSQL Support
      • Blog – PostgreSQL Migration
      • Blog – All DB’s
      • Blog – Linux
    • Courses

      About Courses

      • List Of Courses
      • Become an Instructor
      Greenplum

      Greenplum

      $1,500.00
      Read More

      Blog

      • Home
      • Blog
      • Blog
      • Script to move and compress the postgres logs

      Script to move and compress the postgres logs

      • Posted by 2ndnijam
      • Categories Blog
      • Date February 9, 2019
      • Comments 0 comment

      It is one of the maintenance activity in postgres , once you moved your logs means you will get some more free space at data partition .simple logic is postgres logs is inside the data directory. following script will be helpful to move postgres logs to some other partition .
      1.This script used for moving and compressing  older than 30 days log files:

      vi /home/postgres/eds/tarlog.sh
      find /data/emut16_slavedata/pg_log/ -mtime +30 | xargs  tar -czvPf /pg_xlog/older_log.tar.gz
      
      vi /home/postgres/eds/removelogs.sh
      find /data/emut16_slavedata/pg_log/ -type f -name "*.log" -mtime +30 -exec rm {} \;
      
      but before that get a listing to see what you are about to delete and tar
      find /data/emut16_slavedata/pg_log/ -type f -name "*.log" -mtime +30 -exec ls -tr {} \;

      2.This script used for moving and compressing  older than 30 minutes and hours  log files:

      vi /home/postgres/eds/tarlog.sh
      find /data/emut16_slavedata/pg_log/ -cmin +30 | xargs  tar -czvPf /pg_xlog/older_log.tar.gz
      
      vi /home/postgres/eds/removelogs.sh
      find /data/emut16_slavedata/pg_log/ -type f -name "*.log" -cmin +30 -exec rm {} \;
      
      
      but before that get a listing to see what you are about to delete and tar
      find /data/emut16_slavedata/pg_log/ -type f -name "*.log" -cmin +30 -exec ls -tr {} \;

      If you want to give 3 hours mention like -cmin+180

      • Share:
      2ndnijam

      Previous post

      Script for postgres archive move - If Data is full
      February 9, 2019

      Next post

      script for VACUUM and ANALYZE for postgres database
      February 9, 2019

      Leave A Reply

      You must be logged in to post a comment.

      Connect with



      Search

      ADVERTISEMENT

      Latest Posts

      Don’t See What You’re Looking For? We’ll Customize a Package to Fit Your Business Office space!
      14May2022
      Need an Address, Phone Number, And Virtual Office In Chennai?
      14May2022
      Rayafeel Technologies can provide you with ideal meeting solutions
      14May2022
      Virtual Offices VS. Coworking Spaces: What’s The Difference?
      14May2022
      SQL Manager for Oracle Type 6 – 10
      13May2022
      PostgreSQL

      PostgreSQL

      $800.00 $500.00
      Greenplum

      Greenplum

      $1,500.00
      Oracle Database

      Oracle Database

      $350.00
      2ndquadrant.in

      (+91) 8838953252

      ITsupport@rayafeel.com

      Company

      • About Us
      • Our Team

      COURSES

      • List Of Course
      • Become An Instructor

      Support

      • DBA Support
      • Consultancy Services

      Recommend

      • Login
      • Contact Us

      IT Services by rayafeel.com. Powered by Rayafeel Technologies Pvt Ltd.

      • Privacy
      • Terms

      Become An Instructor?

      Join thousand of instructors and earn money hassle free!

      Get Started Now

      Connect with

      Login with Google Login with Twitter Login with Linkedin Login with Windowslive Login with Yahoo

      Login with your site account

      Connect with



      Lost your password?