summaryrefslogtreecommitdiffstats
path: root/callback_plugins
diff options
context:
space:
mode:
authorSeth Vidal <skvidal@fedoraproject.org>2013-07-03 16:42:56 -0400
committerSeth Vidal <skvidal@fedoraproject.org>2013-07-03 16:42:56 -0400
commit2f1fb8a0793e6f6e8d97144debf1f8427a73f229 (patch)
tree2478c7ad8f9e84c9b3122c609fd682aea282c123 /callback_plugins
parentf40efb290c5fbc6e303cb0db0f3c0ee4c566e650 (diff)
downloadansible-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.py8
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()