Advertisement
Guest User

Untitled

a guest
Jan 29th, 2024
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.82 KB | None | 0 0
  1. localboss@lp53vserver169:~$ cd DEV/back
  2. localboss@lp53vserver169:~/DEV/back$ cd data
  3. localboss@lp53vserver169:~/DEV/back/data$ cd /etc/logrotate.d/
  4. localboss@lp53vserver169:/etc/logrotate.d$ ls
  5. alternatives apt btmp django-logrotate.conf dpkg nginx postgresql-common rsyslog unattended-upgrades wtmp
  6. localboss@lp53vserver169:/etc/logrotate.d$ nano django-logrotate.conf
  7. localboss@lp53vserver169:/etc/logrotate.d$ sudo logrotate -f /etc/logrotate.d/django-logrotate.conf
  8. [sudo] password for localboss:
  9. localboss@lp53vserver169:/etc/logrotate.d$ ls
  10. alternatives apt btmp django-logrotate.conf dpkg nginx postgresql-common rsyslog unattended-upgrades wtmp
  11. localboss@lp53vserver169:/etc/logrotate.d$ cat django-logrotate.conf
  12. ~/DEV/back/data/django.log {
  13. daily
  14. rotate 5
  15. compress
  16. missingok
  17. notifempty
  18. missingok
  19. create 0640 localboss localboss
  20. }
  21.  
  22. localboss@lp53vserver169:/etc/logrotate.d$ sudo logrotate -vf /etc/logrotate.d/django-logrotate.conf
  23. reading config file /etc/logrotate.d/django-logrotate.conf
  24. Reading state from file: /var/lib/logrotate/status
  25. Allocating hash table for state file, size 64 entries
  26. Creating new state
  27. Creating new state
  28. Creating new state
  29. Creating new state
  30. Creating new state
  31. Creating new state
  32. Creating new state
  33. Creating new state
  34. Creating new state
  35. Creating new state
  36. Creating new state
  37. Creating new state
  38. Creating new state
  39. Creating new state
  40. Creating new state
  41. Creating new state
  42. Creating new state
  43. Creating new state
  44. Creating new state
  45. Creating new state
  46. Creating new state
  47. Creating new state
  48. Creating new state
  49. Creating new state
  50. Creating new state
  51. Creating new state
  52.  
  53. Handling 1 logs
  54.  
  55. rotating pattern: ~/DEV/back/data/django.log forced from command line (5 rotations)
  56. empty log files are not rotated, old logs are removed
  57. considering log ~/DEV/back/data/django.log
  58. localboss@lp53vserver169:/etc/logrotate.d$ ls
  59. alternatives apt btmp django-logrotate.conf dpkg nginx postgresql-common rsyslog unattended-upgrades wtmp
  60. localboss@lp53vserver169:/etc/logrotate.d$ mv django-logrotate.conf django
  61. mv: cannot move 'django-logrotate.conf' to 'django': Permission denied
  62. localboss@lp53vserver169:/etc/logrotate.d$ sudo mv django-logrotate.conf django
  63. localboss@lp53vserver169:/etc/logrotate.d$ ls
  64. alternatives apt btmp django dpkg nginx postgresql-common rsyslog unattended-upgrades wtmp
  65. localboss@lp53vserver169:/etc/logrotate.d$ logrotate /etc/logrotate.d/django
  66. -bash: logrotate: command not found
  67. localboss@lp53vserver169:/etc/logrotate.d$ sudo logrotate /etc/logrotate.d/django
  68. localboss@lp53vserver169:/etc/logrotate.d$ sudo logrotate -d /etc/logrotate.d/django
  69. WARNING: logrotate in debug mode does nothing except printing debug messages! Consider using verbose mode (-v) instead if this is not what you want.
  70.  
  71. reading config file /etc/logrotate.d/django
  72. Reading state from file: /var/lib/logrotate/status
  73. Allocating hash table for state file, size 64 entries
  74. Creating new state
  75. Creating new state
  76. Creating new state
  77. Creating new state
  78. Creating new state
  79. Creating new state
  80. Creating new state
  81. Creating new state
  82. Creating new state
  83. Creating new state
  84. Creating new state
  85. Creating new state
  86. Creating new state
  87. Creating new state
  88. Creating new state
  89. Creating new state
  90. Creating new state
  91. Creating new state
  92. Creating new state
  93. Creating new state
  94. Creating new state
  95. Creating new state
  96. Creating new state
  97. Creating new state
  98. Creating new state
  99. Creating new state
  100.  
  101. Handling 1 logs
  102.  
  103. rotating pattern: ~/DEV/back/data/django.log after 1 days (5 rotations)
  104. empty log files are not rotated, old logs are removed
  105. considering log ~/DEV/back/data/django.log
  106. localboss@lp53vserver169:/etc/logrotate.d$ sudo logrotate -vf /etc/logrotate.d/django
  107. reading config file /etc/logrotate.d/django
  108. Reading state from file: /var/lib/logrotate/status
  109. Allocating hash table for state file, size 64 entries
  110. Creating new state
  111. Creating new state
  112. Creating new state
  113. Creating new state
  114. Creating new state
  115. Creating new state
  116. Creating new state
  117. Creating new state
  118. Creating new state
  119. Creating new state
  120. Creating new state
  121. Creating new state
  122. Creating new state
  123. Creating new state
  124. Creating new state
  125. Creating new state
  126. Creating new state
  127. Creating new state
  128. Creating new state
  129. Creating new state
  130. Creating new state
  131. Creating new state
  132. Creating new state
  133. Creating new state
  134. Creating new state
  135. Creating new state
  136.  
  137. Handling 1 logs
  138.  
  139. rotating pattern: ~/DEV/back/data/django.log forced from command line (5 rotations)
  140. empty log files are not rotated, old logs are removed
  141. considering log ~/DEV/back/data/django.log
  142. localboss@lp53vserver169:/etc/logrotate.d$
  143.  
  144.  
  145.  
  146. localboss@lp53vserver169:~$ cd DEV
  147. localboss@lp53vserver169:~/DEV$ cd data
  148. -bash: cd: data: No such file or directory
  149. localboss@lp53vserver169:~/DEV$ cd back
  150. localboss@lp53vserver169:~/DEV/back$ cd data
  151. localboss@lp53vserver169:~/DEV/back/data$ ls
  152. daemon.log django1.log django.log
  153. localboss@lp53vserver169:~/DEV/back/data$ ls -lh
  154. total 170M
  155. -rw-r--r-- 1 www-data www-data 153K Jan 26 16:53 daemon.log
  156. -rw-r--r-- 1 www-data www-data 67M Jan 18 16:26 django1.log
  157. -rw-r--r-- 1 www-data www-data 103M Jan 26 16:53 django.log
  158. localboss@lp53vserver169:~/DEV/back/data$ ls -lh
  159. total 170M
  160. -rw-r--r-- 1 www-data www-data 153K Jan 26 16:53 daemon.log
  161. -rw-r--r-- 1 www-data www-data 67M Jan 18 16:26 django1.log
  162. -rw-r--r-- 1 www-data www-data 103M Jan 26 16:53 django.log
  163. localboss@lp53vserver169:~/DEV/back/data$ /usr/sbin/logrotate /etc/logrotate.conf --verbose --force |& grep -i '[^-_/.]error'
  164. error: error opening state file /var/lib/logrotate/status: Permission denied
  165. localboss@lp53vserver169:~/DEV/back/data$ sudo /usr/sbin/logrotate /etc/logrotate.conf --verbose --force |& grep -i '[^-_/.]error'
  166. [sudo] password for localboss:
  167. localboss@lp53vserver169:~/DEV/back/data$ sudo chmod 644 /etc/
  168. Display all 167 possibilities? (y or n)
  169. localboss@lp53vserver169:~/DEV/back/data$ sudo chmod 644 /etc/log
  170. logcheck/ login.defs logrotate.conf logrotate.d/
  171. localboss@lp53vserver169:~/DEV/back/data$ sudo chmod 644 /etc/log
  172. logcheck/ login.defs logrotate.conf logrotate.d/
  173. localboss@lp53vserver169:~/DEV/back/data$ sudo chmod 644 /etc/logrotate.conf
  174. localboss@lp53vserver169:~/DEV/back/data$ cd /etc
  175. localboss@lp53vserver169:/etc$ nano logrotate.conf
  176. localboss@lp53vserver169:/etc$ nano logrotate.conf
  177. localboss@lp53vserver169:/etc$ man logrotate
  178. localboss@lp53vserver169:/etc$ ls -lh /DEV/back/data
  179. ls: cannot access '/DEV/back/data': No such file or directory
  180. localboss@lp53vserver169:/etc$ ls -lh ~/DEV/back/data
  181. total 170M
  182. -rw-r--r-- 1 www-data www-data 153K Jan 26 16:53 daemon.log
  183. -rw-r--r-- 1 www-data www-data 67M Jan 18 16:26 django1.log
  184. -rw-r--r-- 1 www-data www-data 103M Jan 26 16:53 django.log
  185. localboss@lp53vserver169:/etc$ cat logrotate.conf
  186. # see "man logrotate" for details
  187.  
  188. # global options do not affect preceding include directives
  189.  
  190. # rotate log files weekly
  191. weekly
  192.  
  193. # keep 4 weeks worth of backlogs
  194. rotate 4
  195.  
  196. # create new (empty) log files after rotating old ones
  197. create
  198.  
  199. # use date as a suffix of the rotated file
  200. #dateext
  201.  
  202. # uncomment this if you want your log files compressed
  203. #compress
  204.  
  205. # packages drop log rotation information into this directory
  206. include /etc/logrotate.d
  207.  
  208. # system-specific logs may also be configured here.
  209. localboss@lp53vserver169:/etc$ sudo nano logrotate.conf
  210.  
  211.  
  212. Use "fg" to return to nano.
  213.  
  214. [1]+ Stopped sudo nano logrotate.conf
  215. localboss@lp53vserver169:/etc$ fg
  216. sudo nano logrotate.conf
  217. localboss@lp53vserver169:/etc$ ls -lh ~/DEV/back/data
  218. total 170M
  219. -rw-r--r-- 1 www-data www-data 153K Jan 26 16:53 daemon.log
  220. -rw-r--r-- 1 www-data www-data 67M Jan 18 16:26 django1.log
  221. -rw-r--r-- 1 www-data www-data 103M Jan 26 16:53 django.log
  222. localboss@lp53vserver169:/etc$
  223.  
  224.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement