diff options
| author | Seth Vidal <skvidal@fedoraproject.org> | 2013-07-03 16:42:56 -0400 |
|---|---|---|
| committer | Seth Vidal <skvidal@fedoraproject.org> | 2013-07-03 16:42:56 -0400 |
| commit | 2f1fb8a0793e6f6e8d97144debf1f8427a73f229 (patch) | |
| tree | 2478c7ad8f9e84c9b3122c609fd682aea282c123 /callback_plugins | |
| parent | f40efb290c5fbc6e303cb0db0f3c0ee4c566e650 (diff) | |
| download | ansible-2f1fb8a0793e6f6e8d97144debf1f8427a73f229.tar.gz ansible-2f1fb8a0793e6f6e8d97144debf1f8427a73f229.tar.xz ansible-2f1fb8a0793e6f6e8d97144debf1f8427a73f229.zip | |
new sub path for logs:
/var/log/ansible/$playbook_name/YYYY/MM/DD/HH.mm.SS/<logs here>
make the playbook.info file be playbook-$PID.info
Diffstat (limited to 'callback_plugins')
| -rw-r--r-- | callback_plugins/logdetail.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/callback_plugins/logdetail.py b/callback_plugins/logdetail.py index 588d1d820..adf40347c 100644 --- a/callback_plugins/logdetail.py +++ b/callback_plugins/logdetail.py @@ -30,6 +30,7 @@ LOG_PATH = '/var/log/ansible' class LogMech(object): def __init__(self): self.started = time.time() + self.pid = os.getpid() self._pb_fn = None self._last_task_start = None self.play_info = {} @@ -57,9 +58,8 @@ class LogMech(object): @property def logpath_play(self): # this is all to get our path to look nice ish - day = time.strftime('%Y/%m/%d', time.localtime(self.started)) - offset_in_sec = str(self.started - time.mktime(time.strptime(day, '%Y/%m/%d'))) - path = os.path.normpath(self.logpath + '/' + day + '/' + self.playbook_id + '/' + offset_in_sec) + tstamp = time.strftime('%Y/%m/%d/%H.%M.%S', time.localtime(self.started)) + path = os.path.normpath(self.logpath + '/' + self.playbook_id + '/' + tstamp + '/') if not os.path.exists(path): try: @@ -74,7 +74,7 @@ class LogMech(object): # record out playbook.log # include path to playbook, checksums, user running playbook # any args we can get back from the invocation - fd = open(self.logpath_play + '/' + 'playbook.info', 'a') + fd = open(self.logpath_play + '/' + 'playbook-' + self.pid + '.info', 'a') fd.write('%s\n' % content) fd.close() |
