def get_logs(
        self,
        container=None,
        previous=None,
        tail_lines=None,
        regex_replacer_patterns: Optional[List["NamedRegexPattern"]] = None,
        regex_replacement_style: Optional[RegexReplacementStyle] = None,
        filter_regex: Optional[str] = None,
    ) -> str:
        """
        Fetch pod logs, can replace sensitive data in the logs using a regex
        """
        if not container and self.spec.containers:
            container = self.spec.containers[0].name
        pods_logs = get_pod_logs(
            self.metadata.name,
            self.metadata.namespace,
            container,
            previous,
            tail_lines,
        )

        if pods_logs and filter_regex:
            regex = re.compile(filter_regex)
            pods_logs = "\n".join(re.findall(regex, pods_logs))

        if pods_logs and regex_replacer_patterns:
            logging.info("Sanitizing log data with the provided regex patterns")
            if regex_replacement_style == RegexReplacementStyle.NAMED:
                for replacer in regex_replacer_patterns:
                    pods_logs = re.sub(replacer.regex, f"[{replacer.name.upper()}]", pods_logs)
            else:

                def same_length_asterisks(match):
                    return "*" * len((match.group(0)))

                for replacer in regex_replacer_patterns:
                    pods_logs = re.sub(replacer.regex, same_length_asterisks, pods_logs)

        return pods_logs

        Fetch pod logs, can replace sensitive data in the logs using a regex
        
src/robusta/integrations/kubernetes/custom_models.py