diff --git a/plugins/logs/logs.py b/plugins/logs/logs.py index 5910e3c..88afc91 100644 --- a/plugins/logs/logs.py +++ b/plugins/logs/logs.py @@ -73,18 +73,19 @@ class logs(cryptobox.plugins.base.CryptoBoxPlugin): self.cbox.prefs["Log"]["Destination"].lower() ## this generates more download buttons if the files are available - try: - syslogfile = self.defaults["syslogfile"].lower() - if os.access(syslogfile, os.R_OK): + if "syslogfile" in self.defaults: + try: + syslogfile = self.defaults["syslogfile"] + except KeyError: + self.cbox.log.error("could not evaluate the config setting: " + + "[logs]->syslogfile") + if syslogfile and os.access(syslogfile, os.R_OK): self.cbox.log.info("[logs]->syslogfile: '%s' will be exported" % syslogfile) self.hdf[self.hdf_prefix + "syslogfile"] = "readable" + self.cbox.prefs["Log"]["syslogfile"] = syslogfile else: self.cbox.log.warn("[logs]->syslogfile: '%s' is not readable for cryptobox user" % syslogfile) self.hdf[self.hdf_prefix + "syslogfile"] = "not readable" - except KeyError: - self.cbox.log.error( - "could not evaluate the config setting: " - + "[logs]->syslogfile") return "show_log" @@ -94,12 +95,26 @@ class logs(cryptobox.plugins.base.CryptoBoxPlugin): **kargs are necessary - we have to ignore 'weblang' and so on ... """ + ##TODO: check the download url to know which file is wanted + if self.cbox.prefs["Log"]["syslogfile"]: + try: + syslogfile = self.cbox.prefs["Log"]["syslogfile"] + except KeyError: + self.cbox.log.error("could not evaluate the config setting: " + + "[logs]->syslogfile %s") + if syslogfile and os.access(syslogfile, os.R_OK): + return cherrypy.lib.cptools.serveFile(syslogfile, + disposition="attachment", name="syslog.txt") + else: + self.cbox.log.error("'%s' could not be exposed" % syslogfile) + log_file = self.__get_log_destination_file() if log_file is None: return "" else: return cherrypy.lib.cptools.serveFile(log_file, disposition="attachment", name="cryptobox_logfile.txt") + def get_status(self): """The current status includes the log configuration details. diff --git a/plugins/logs/show_log.cs b/plugins/logs/show_log.cs index 314b3f2..c9e88c1 100644 --- a/plugins/logs/show_log.cs +++ b/plugins/logs/show_log.cs @@ -71,7 +71,7 @@

- +

diff --git a/src/cryptobox/web/sites.py b/src/cryptobox/web/sites.py index 6eeca34..5b5ec60 100644 --- a/src/cryptobox/web/sites.py +++ b/src/cryptobox/web/sites.py @@ -434,21 +434,6 @@ class WebInterfaceSites: time.sleep(1) yield "

" - @cherrypy.expose - def syslog(self, weblang="", help="0", device=None): - """export syslog - """ - from cherrypy.lib.cptools import serveFile - try: - syslogfile = self.cbox.prefs["PluginSettings"]["logs"]["syslogfile"] - if os.access(syslogfile, os.R_OK): - return serveFile(syslogfile, disposition="attachment", name="syslog") - else: - self.cbox.log.error("'%s' could not be exposed" % syslogfile) - except KeyError: - self.cbox.log.error( - "could not evaluate the config setting: " - + "[logs]->syslogfile %s") ##################### input checker ##########################