Browse Source

accessbot logs : add timestamp and rotate

Change-Id: I7ec6a4a38197acd33704d950d205895ce45e6708
changes/06/588106/2
Ian Wienand 9 months ago
parent
commit
2ebab74d16
2 changed files with 17 additions and 1 deletions
  1. 3
    1
      files/accessbot.py
  2. 14
    0
      manifests/init.pp

+ 3
- 1
files/accessbot.py View File

@@ -24,7 +24,9 @@ import sys
24 24
 import time
25 25
 import yaml
26 26
 
27
-logging.basicConfig(level=logging.DEBUG)
27
+logging.basicConfig(
28
+    format='%(asctime)s [%(levelname)s] %(name)s - %(message)s',
29
+    level=logging.DEBUG)
28 30
 
29 31
 
30 32
 class SetAccess(irc.client.SimpleIRCClient):

+ 14
- 0
manifests/init.pp View File

@@ -57,6 +57,20 @@ class accessbot(
57 57
     require => User['accessbot'],
58 58
   }
59 59
 
60
+  include ::logrotate
61
+  logrotate::file { 'accessbot.log':
62
+    ensure  => present,
63
+    log     => '/var/log/accessbot/accessbot.log',
64
+    options => ['compress',
65
+                'copytruncate',
66
+                'delaycompress',
67
+                'missingok',
68
+                'rotate 7',
69
+                'daily',
70
+                'notifempty',
71
+                ],
72
+  }
73
+
60 74
   file { '/etc/accessbot/accessbot.config':
61 75
     ensure  => present,
62 76
     content => template('accessbot/accessbot.config.erb'),

Loading…
Cancel
Save