Skip to content

Instantly share code, notes, and snippets.

@imShakil
Last active February 24, 2025 10:14
Show Gist options
  • Save imShakil/8895150e319407b3c1c30d06a28fdabc to your computer and use it in GitHub Desktop.
Save imShakil/8895150e319407b3c1c30d06a28fdabc to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import os
import sys
import zipfile
root_path = ''
version_info = ''
directory_list = {'oxauth': '/opt/gluu/jetty/oxauth/logs/',
'identity': '/opt/gluu/jetty/identity/logs/',
'idp': '/opt/gluu/jetty/idp/logs/',
'setup': '/install/community-edition-setup/',
'shibboleth': '/opt/shibboleth-idp/logs/',
'oxauth-rp': '/opt/gluu/jetty/oxauth-rp/logs/',
'redis': '/opt/gluu/node/passport/node_modules/redis-parser/',
'apache': '/var/log/apache2/',
'passport': '/opt/gluu/node/passport/logs'}
# to check file is running from out side of gluu-server
if os.path.exists('/opt/gluu/jetty/oxauth'):
version_info = os.popen('/opt/gluu/bin/show_version.py').read()
else:
root_path = '/opt/gluu-server'
version_info = os.popen('/sbin/gluu-serverd version').read()
if version_info == '':
sys.exit('Run this program as a root user')
handle = zipfile.ZipFile('All_logs.zip', 'w')
for directory_name in directory_list:
path = root_path + directory_list[directory_name]
if os.path.exists(path):
os.chdir(path)
for file in os.listdir():
if file.endswith('.log'):
handle.write(file,
os.path.relpath(os.path.join(directory_name, file), path),
compress_type=zipfile.ZIP_DEFLATED)
handle.writestr('version_info.txt', version_info)
handle.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment