Exemplo n.º 1
0
def store_lambda_logs(lambda_function: LambdaFunction,
                      log_output: str,
                      invocation_time=None,
                      container_id=None):
    log_group_name = "/aws/lambda/%s" % lambda_function.name()
    container_id = container_id or short_uid()
    invocation_time = invocation_time or int(time.time() * 1000)
    invocation_time_secs = int(invocation_time / 1000)
    time_str = time.strftime("%Y/%m/%d", time.gmtime(invocation_time_secs))
    log_stream_name = "%s/[LATEST]%s" % (time_str, container_id)
    return store_cloudwatch_logs(log_group_name, log_stream_name, log_output,
                                 invocation_time)
Exemplo n.º 2
0
def store_lambda_logs(lambda_function: LambdaFunction,
                      log_output: str,
                      invocation_time=None,
                      container_id=None):
    # leave here to avoid import issues from CLI
    from localstack.utils.cloudwatch.cloudwatch_util import store_cloudwatch_logs

    log_group_name = "/aws/lambda/%s" % lambda_function.name()
    container_id = container_id or short_uid()
    invocation_time = invocation_time or int(time.time() * 1000)
    invocation_time_secs = int(invocation_time / 1000)
    time_str = time.strftime("%Y/%m/%d", time.gmtime(invocation_time_secs))
    log_stream_name = "%s/[LATEST]%s" % (time_str, container_id)
    return store_cloudwatch_logs(log_group_name, log_stream_name, log_output,
                                 invocation_time)
 def handle(func):
     func_name = func['FunctionName']
     if re.match(filter, func_name):
         arn = func['FunctionArn']
         f = LambdaFunction(arn)
         pool[arn] = f
         result.append(f)
         if details:
             sources = get_lambda_event_sources(f.name(), env=env)
             for src in sources:
                 arn = src['EventSourceArn']
                 f.event_sources.append(EventSource.get(arn, pool=pool))
             try:
                 code_map = get_lambda_code(func_name, env=env)
                 f.targets = extract_endpoints(code_map, pool)
             except Exception:
                 LOG.warning("Unable to get code for lambda '%s'" % func_name)
Exemplo n.º 4
0
 def handle(func):
     func_name = func['FunctionName']
     if re.match(filter, func_name):
         arn = func['FunctionArn']
         f = LambdaFunction(arn)
         pool[arn] = f
         result.append(f)
         if details:
             sources = get_lambda_event_sources(f.name(), env=env)
             for src in sources:
                 arn = src['EventSourceArn']
                 f.event_sources.append(EventSource.get(arn, pool=pool))
             try:
                 code_map = get_lambda_code(func_name, env=env)
                 f.targets = extract_endpoints(code_map, pool)
             except Exception:
                 LOG.warning("Unable to get code for lambda '%s'" % func_name)