serverless-plugin-log-subscription icon indicating copy to clipboard operation
serverless-plugin-log-subscription copied to clipboard

[Feature] - Set api gateway destination arn separately from lambda destination arn

Open codezninja opened this issue 2 years ago • 0 comments

The parsing of logs between lambda and api gateway can be different. Would it be possible to set the destination arn for api gateway logs to to have a different value instead?

ie

custom:
  logSubscription:
    enabled: true
    destinationArn: arn:aws:logs:${self:provider.region}:xxxxxxxxx:destination:xxxxxxxxx-cloudwatch-lambda-destination-${self:provider.region}
    apiGatewayLogs:
      destinationArn: arn:aws:logs:${self:provider.region}:xxxxxxxxx:destination:xxxxxxxxx-cloudwatch-api-gateway-destination-${self:provider.region}

Current workaround

Manually set the api gateway log subscription and set option as false for plugin

resources:
  Resources:
    ApiGatewaySubscription:
      Type: AWS::Logs::SubscriptionFilter
      DependsOn:
        - ApiGatewayRestApi
        - ApiGatewayLogGroup
      Properties:
        DestinationArn: "arn:aws:logs:${self:provider.region}:xxxxxxxxx:destination:xxxxxxxxx-api-gateway-destination-${self:provider.region}"
        FilterPattern: ""
        LogGroupName:
          Fn::Sub: "API-Gateway-Execution-Logs_${ApiGatewayRestApi}/${self:custom.stage}"

codezninja avatar Jul 03 '23 14:07 codezninja