PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` """ FortiMonitor Countermeasure log helper - base class to allow easy gathering of diagnostic data from local log files. Copyright 2023 Fortinet, Inc. All Rights Reserved. fm-ops@fortinet.com To use, create a subclass of CountermeasureLogHelper and define the following properties: - name - A human-readable name for the countermeasure - textkey - A unique textkey describing the countermeasure - log_file: The log file or log files to gather. Either a string for a single file or a list of strings for multiple. Must specify the full path to the log file and the agent must have read access to the file - line_count: Count of lines to retrieve from the bottom of the log file(s) - description: Optional longer description of what the plugin does For example: class ApacheLogCountermeasure(CountermeasureLogHelper): name = "Apache logs" textkey = "logs.apache" description = "Get recent Apache logs" log_file = ["/var/log/apache/access.log", "/var/log/apache/error.log"] line_count = 100 """ from CountermeasurePlugin import CountermeasurePlugin class CountermeasureLogHelper(CountermeasurePlugin): wall_announce_delay = None max_frequency = None max_runtime = None sudo_requirements = [] author = "support@panopta.com" # The log file(s) to retrieve log_file = None # How many lines to capture line_count = 100 def validate(self): problems = [] if self.name == "Base Countermeasure": problems.append("Missing name definition") if self.textkey == "base": problems.append("Missing textkey definition") if self.log_file is None: problems.append("Missing log file definition") try: lines = int(self.line_count) except: problems.append("Invalid line count definition") return problems and ", ".join(problems) or None def run(self): if type(self.log_file) in (type(""), type(u"")): self.log_file = [self.log_file] output = "" for file in self.log_file: output += "%s:\n" % file return_code, sub_output = self. execute("tail -n %s %s" % (self.line_count, file)) output += sub_output output += "\n\n" self.save_text_output(output)