audit_log.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:insights-core 作者: RedHatInsights 项目源码 文件源码
def get_after(self, timestamp, s=None):
        """
        Find all the (available) logs that are after the given time stamp.
        Override this function in class LogFileOutput.

        Parameters:

            timestamp(datetime.datetime): lines before this time are ignored.
            s(str or list): one or more strings to search for.
                If not supplied, all available lines are searched.

        Yields:
            (dict): the parsed data of lines with timestamps after this date in the
            same format they were supplied.
        """
        search_by_expression = self._valid_search(s)
        for line in self.lines:
            # If `s` is not None, keywords must be found in the line
            if s and not search_by_expression(line):
                continue
            info = self._parse_line(line)
            try:
                logtime = date.fromtimestamp(float(info.get('timestamp', 0)))
                if logtime > timestamp:
                    yield info
            except:
                pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号