class_docstr: Abstract Parser class to be inherited by all StreamAlert Parsers
class_docstr_tok: ["Abstract","Parser","class","to","be","inherited","by","all","StreamAlert","Parsers"]
docstr: Check if all log patterns specified for this record match
  
  Args:
      record (dict): Parsed record value
      log_patterns (dict): Log patterns that should be enforced for the data
      being parsed. This could be checking a nested value, so it should be
      passed in as an argument.
  
  Returns:
      bool: True if all specified log patterns match, False otherwise
docstr_tok: ["Check","if","all","log","patterns","specified","for","this","record","match","Args",":","record","(","dict",")",":","Parsed","record","value","log_patterns","(","dict",")",":","Log","patterns","that","should","be","enforced","for","the","data","being","parsed",".","This","could","be","checking","a","nested","value",",","so","it","should","be","passed","in","as","an","argument",".","Returns",":","bool",":","True","if","all","specified","log","patterns","match",",","False","otherwise"]
code: def _matches_log_patterns(cls, record, log_patterns, envelope=None):
      """Check if all log patterns specified for this record match
  
      Args:
          record (dict): Parsed record value
          log_patterns (dict): Log patterns that should be enforced for the data
          being parsed. This could be checking a nested value, so it should be
          passed in as an argument.
  
      Returns:
          bool: True if all specified log patterns match, False otherwise
      """
      # Return True immediately if there are no log patterns
      if not log_patterns:
          return True
  
      result = True
      for field, patterns in log_patterns.items():
          if field == cls.ENVELOPE_KEY:
              return cls._matches_log_patterns(envelope, patterns)
  
          # handle nested log_patterns
          if isinstance(patterns, dict):
              return cls._matches_log_patterns(record[field], patterns)
  
          # Transform a flat pattern into a list
          if isinstance(patterns, str):
              LOGGER.debug(
                  "Transforming flat pattern '%s' into list", patterns
              )
              patterns = [patterns]
  
          # Ensure the pattern key is in the record
          if field not in record:
              LOGGER.error(
                  "Declared log pattern key [%s] does exist in record:\n%s",
                  field,
                  record,
              )
              return False
  
          value = record.get(field)
  
          # Ensure at least one of the log_patterns matches
          result = result and any(
              fnmatch(value, pattern) for pattern in patterns
          )
  
      LOGGER.debug(
          "%s log pattern match result: %s", cls.type(), result
      )
  
      # If all pattern match results are True
      return result
  
imports: from abc import ABCMeta, abstractmethod
  from copy import deepcopy
  import csv
  from fnmatch import fnmatch
  import json
  import logging
  import re
  import io
  import jmespath
  from streamalert.shared.logger import get_logger
label_desc: Use image node_id 19 for calling the ParserBase obj's underlying member method code with example usage: obj._matches_log_patterns(cls, record, log_patterns, envelope) and returns: result, True, cls, cls, False