Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- localboss@lp53vserver169:~$ cd DEV/back
- localboss@lp53vserver169:~/DEV/back$ cd data
- localboss@lp53vserver169:~/DEV/back/data$ cd /etc/logrotate.d/
- localboss@lp53vserver169:/etc/logrotate.d$ ls
- alternatives apt btmp django-logrotate.conf dpkg nginx postgresql-common rsyslog unattended-upgrades wtmp
- localboss@lp53vserver169:/etc/logrotate.d$ nano django-logrotate.conf
- localboss@lp53vserver169:/etc/logrotate.d$ sudo logrotate -f /etc/logrotate.d/django-logrotate.conf
- [sudo] password for localboss:
- localboss@lp53vserver169:/etc/logrotate.d$ ls
- alternatives apt btmp django-logrotate.conf dpkg nginx postgresql-common rsyslog unattended-upgrades wtmp
- localboss@lp53vserver169:/etc/logrotate.d$ cat django-logrotate.conf
- ~/DEV/back/data/django.log {
- daily
- rotate 5
- compress
- missingok
- notifempty
- missingok
- create 0640 localboss localboss
- }
- localboss@lp53vserver169:/etc/logrotate.d$ sudo logrotate -vf /etc/logrotate.d/django-logrotate.conf
- reading config file /etc/logrotate.d/django-logrotate.conf
- Reading state from file: /var/lib/logrotate/status
- Allocating hash table for state file, size 64 entries
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Handling 1 logs
- rotating pattern: ~/DEV/back/data/django.log forced from command line (5 rotations)
- empty log files are not rotated, old logs are removed
- considering log ~/DEV/back/data/django.log
- localboss@lp53vserver169:/etc/logrotate.d$ ls
- alternatives apt btmp django-logrotate.conf dpkg nginx postgresql-common rsyslog unattended-upgrades wtmp
- localboss@lp53vserver169:/etc/logrotate.d$ mv django-logrotate.conf django
- mv: cannot move 'django-logrotate.conf' to 'django': Permission denied
- localboss@lp53vserver169:/etc/logrotate.d$ sudo mv django-logrotate.conf django
- localboss@lp53vserver169:/etc/logrotate.d$ ls
- alternatives apt btmp django dpkg nginx postgresql-common rsyslog unattended-upgrades wtmp
- localboss@lp53vserver169:/etc/logrotate.d$ logrotate /etc/logrotate.d/django
- -bash: logrotate: command not found
- localboss@lp53vserver169:/etc/logrotate.d$ sudo logrotate /etc/logrotate.d/django
- localboss@lp53vserver169:/etc/logrotate.d$ sudo logrotate -d /etc/logrotate.d/django
- WARNING: logrotate in debug mode does nothing except printing debug messages! Consider using verbose mode (-v) instead if this is not what you want.
- reading config file /etc/logrotate.d/django
- Reading state from file: /var/lib/logrotate/status
- Allocating hash table for state file, size 64 entries
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Handling 1 logs
- rotating pattern: ~/DEV/back/data/django.log after 1 days (5 rotations)
- empty log files are not rotated, old logs are removed
- considering log ~/DEV/back/data/django.log
- localboss@lp53vserver169:/etc/logrotate.d$ sudo logrotate -vf /etc/logrotate.d/django
- reading config file /etc/logrotate.d/django
- Reading state from file: /var/lib/logrotate/status
- Allocating hash table for state file, size 64 entries
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Creating new state
- Handling 1 logs
- rotating pattern: ~/DEV/back/data/django.log forced from command line (5 rotations)
- empty log files are not rotated, old logs are removed
- considering log ~/DEV/back/data/django.log
- localboss@lp53vserver169:/etc/logrotate.d$
- localboss@lp53vserver169:~$ cd DEV
- localboss@lp53vserver169:~/DEV$ cd data
- -bash: cd: data: No such file or directory
- localboss@lp53vserver169:~/DEV$ cd back
- localboss@lp53vserver169:~/DEV/back$ cd data
- localboss@lp53vserver169:~/DEV/back/data$ ls
- daemon.log django1.log django.log
- localboss@lp53vserver169:~/DEV/back/data$ ls -lh
- total 170M
- -rw-r--r-- 1 www-data www-data 153K Jan 26 16:53 daemon.log
- -rw-r--r-- 1 www-data www-data 67M Jan 18 16:26 django1.log
- -rw-r--r-- 1 www-data www-data 103M Jan 26 16:53 django.log
- localboss@lp53vserver169:~/DEV/back/data$ ls -lh
- total 170M
- -rw-r--r-- 1 www-data www-data 153K Jan 26 16:53 daemon.log
- -rw-r--r-- 1 www-data www-data 67M Jan 18 16:26 django1.log
- -rw-r--r-- 1 www-data www-data 103M Jan 26 16:53 django.log
- localboss@lp53vserver169:~/DEV/back/data$ /usr/sbin/logrotate /etc/logrotate.conf --verbose --force |& grep -i '[^-_/.]error'
- error: error opening state file /var/lib/logrotate/status: Permission denied
- localboss@lp53vserver169:~/DEV/back/data$ sudo /usr/sbin/logrotate /etc/logrotate.conf --verbose --force |& grep -i '[^-_/.]error'
- [sudo] password for localboss:
- localboss@lp53vserver169:~/DEV/back/data$ sudo chmod 644 /etc/
- Display all 167 possibilities? (y or n)
- localboss@lp53vserver169:~/DEV/back/data$ sudo chmod 644 /etc/log
- logcheck/ login.defs logrotate.conf logrotate.d/
- localboss@lp53vserver169:~/DEV/back/data$ sudo chmod 644 /etc/log
- logcheck/ login.defs logrotate.conf logrotate.d/
- localboss@lp53vserver169:~/DEV/back/data$ sudo chmod 644 /etc/logrotate.conf
- localboss@lp53vserver169:~/DEV/back/data$ cd /etc
- localboss@lp53vserver169:/etc$ nano logrotate.conf
- localboss@lp53vserver169:/etc$ nano logrotate.conf
- localboss@lp53vserver169:/etc$ man logrotate
- localboss@lp53vserver169:/etc$ ls -lh /DEV/back/data
- ls: cannot access '/DEV/back/data': No such file or directory
- localboss@lp53vserver169:/etc$ ls -lh ~/DEV/back/data
- total 170M
- -rw-r--r-- 1 www-data www-data 153K Jan 26 16:53 daemon.log
- -rw-r--r-- 1 www-data www-data 67M Jan 18 16:26 django1.log
- -rw-r--r-- 1 www-data www-data 103M Jan 26 16:53 django.log
- localboss@lp53vserver169:/etc$ cat logrotate.conf
- # see "man logrotate" for details
- # global options do not affect preceding include directives
- # rotate log files weekly
- weekly
- # keep 4 weeks worth of backlogs
- rotate 4
- # create new (empty) log files after rotating old ones
- create
- # use date as a suffix of the rotated file
- #dateext
- # uncomment this if you want your log files compressed
- #compress
- # packages drop log rotation information into this directory
- include /etc/logrotate.d
- # system-specific logs may also be configured here.
- localboss@lp53vserver169:/etc$ sudo nano logrotate.conf
- Use "fg" to return to nano.
- [1]+ Stopped sudo nano logrotate.conf
- localboss@lp53vserver169:/etc$ fg
- sudo nano logrotate.conf
- localboss@lp53vserver169:/etc$ ls -lh ~/DEV/back/data
- total 170M
- -rw-r--r-- 1 www-data www-data 153K Jan 26 16:53 daemon.log
- -rw-r--r-- 1 www-data www-data 67M Jan 18 16:26 django1.log
- -rw-r--r-- 1 www-data www-data 103M Jan 26 16:53 django.log
- localboss@lp53vserver169:/etc$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement