Trimming listener.log
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Trimming listener.log

  1. #1
    Join Date
    Jul 2002
    Posts
    205

    Trimming listener.log

    Hi,

    I want to trim the listner.log periodically by a cron job keeping copy of the original alert.log.

    Any one has any shell script for this.

    Please help.

  2. #2
    Join Date
    May 2002
    Posts
    2,645
    You can Google oracle rotate listener log and try one of the 100,000 plus hits on this topic.

    Do you mean listener log or the alert log, since you mention both in your question? What do you mean by trim? Keep part of the original in the new version of the file? Or do you mean rotate?

  3. #3
    Join Date
    Jul 2002
    Posts
    205
    I want to copy the listener.log file to other file with todays date. Then make the original file with 0 bytes.

  4. #4
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,476

    Cool

    You can add this code snippet to your script:
    Code:
            ####### Cleanup Network Logs ######
            ###########   Start   #############
            for file in `ls $NET_DIR/*.log`
            do
              if [ `ls -ltr $file|awk '{print $5}'` -gt 10485760 ] # 10MB
              then
                NEWFILE=$file.`date +%m%d%y`
                cp -p $file $NEWFILE
                cp /dev/null $file
                echo "Log File Moved: $file"
                gzip $NEWFILE
                find $NET_DIR -name "*.gz" -mtime +60 -exec rm {} \; 2>/dev/null
              fi
            done
    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width