serverless-plugin-datadog 3.0.0 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,4 +1,10 @@
1
- # Datadog Serverless Plugin
1
+ ---
2
+ title: Datadog Serverless Plugin
3
+ kind: documentation
4
+ aliases:
5
+ - /serverless/serverless_integrations/plugin/
6
+ dependencies: ["https://github.com/DataDog/serverless-plugin-datadog/blob/master/README.md"]
7
+ ---
2
8
 
3
9
  ![build](https://github.com/DataDog/serverless-plugin-datadog/workflows/build/badge.svg)
4
10
  [![Code Coverage](https://img.shields.io/codecov/c/github/DataDog/serverless-plugin-datadog)](https://codecov.io/gh/DataDog/serverless-plugin-datadog)
@@ -25,31 +31,32 @@ Each version of the plugin is published with a [specific set of versions of the
25
31
 
26
32
  To further configure your plugin, use the following custom parameters in your `serverless.yml`:
27
33
 
28
- | Parameter | Description |
29
- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
30
- | `flushMetricsToLogs` | Send custom metrics by using logs with the Datadog Forwarder Lambda function (recommended). Defaults to `true`. If you disable this parameter, it's required to set `apiKey` (or `apiKMSKey` if encrypted). `flushMetricsToLogs` is ignored when `addExtension` is true. |
31
- | `site` | Set which Datadog site to send data, this is only used when `flushMetricsToLogs` is `false` or `addExtension` is `true`. Possible values are `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com` and `ddog-gov.com`. The default is `datadoghq.com`. |
32
- | `apiKey` | Datadog API Key, only needed when `flushMetricsToLogs` is `false` or `addExtension` is `true`. Defining `apiKey` will add the Datadog API key directly to your Lambda functions as an environment variable. For more information about getting a Datadog API key, see the [API key documentation][3]. |
33
- | `apiKMSKey` | Datadog API Key encrypted using KMS. Use this parameter in place of `apiKey` when `flushMetricsToLogs` is `false` or `addExtension` is `true`, and you are using KMS encryption. Defining `apiKMSKey` will add the Datadog API Key directly to your Lambda functions as an environment variable. |
34
- | `monitorsApiKey` | Datadog API Key. Only needed when using plugin to create monitors for your functions and when `monitors` is defined. Separate from `apiKey` with your function, `monitorsApiKey` is only used to create monitors through the Datadog Monitors API. You may use the same API key for both `apiKey` and `monitorsApiKey`. |
35
- | `monitorsAppKey` | Datadog Application Key. Only needed when using plugin to create monitors for your function and when `monitors` is defined. |
36
- | `addLayers` | Whether to install the Datadog Lambda library as a layer. Defaults to `true`. Set to `false` when you plan to package the Datadog Lambda library to your function's deployment package on your own so that you can install a specific version of the Datadog Lambda library ([Python][4] or [Node.js][5]). |
37
- | `addExtension` | Whether to install the Datadog Lambda Extension as a layer. Defaults to `false`. When enabled, it's required to set the `apiKey` (or `apiKMSKey`) parameter. Learn more about the Lambda Extension Layer [here][8]. Note: AWS only supports Lambda Extensions for [certain runtimes][9]. |
38
- | `logLevel` | The log level, set to `DEBUG` for extended logging. |
39
- | `enableXrayTracing` | Set `true` to enable X-Ray tracing on the Lambda functions and API Gateway integrations. Defaults to `false`. |
40
- | `enableDDTracing` | Enable Datadog tracing on the Lambda function. Note: This applies only to integrations using the Datadog Extension. Defaults to `true`. |
41
- | `enableDDLogs` | Enable Datadog log collection for the Lambda function. Note: This setting has no effect on logs sent via the Datadog Forwarder. Defaults to `true`. |
42
- | `subscribeToApiGatewayLogs` | Enable automatic subscription of the Datadog Forwarder to API Gateway log groups. Defaults to `true`. |
43
- | `subscribeToHttpApiLogs` | Enable automatic subscription of the Datadog Forwarder to Http-api log groups. Defaults to `true`. |
44
- | `subscribeToWebsocketLogs` | Enable automatic subscription of the Datadog Forwarder to Websocket log groups. Defaults to `true`. |
45
- | `forwarderArn` | Setting this parameter subscribes the given Datadog forwarder to the Lambda functions’ CloudWatch log groups. Required when `enableDDTracing` is set to `true` unless the subscription is otherwise applied. For example, if a Datadog Forwarder subscription is applied via Datadog's AWS Integration, then `forwarderArn` is not required. |
46
- | `integrationTesting` | Set `true` when running integration tests. This will bypass the validation of the Forwarder ARN and the addition of Datadog Monitor output links. Defaults to `false`. |
47
- | `enableTags` | When set, automatically tag the Lambda functions with the `service` and `env` tags using the `service` and `stage` values from the serverless application definition. It does NOT override if a `service` or `env` tag already exists. Defaults to `true`. |
48
- | `injectLogContext` | When set, the lambda layer will automatically patch console.log with Datadog's tracing ids. Defaults to `true`. |
49
- | `exclude` | When set, this plugin will ignore all specified functions. Use this parameter if you have any functions that should not include Datadog functionality. Defaults to `[]`. |
50
- | `enabled` | When set to false, the Datadog plugin will stay inactive. Defaults to `true`. You can control this option using an environment variable, e.g. `enabled: ${strToBool(${env:DD_PLUGIN_ENABLED, true})}`, to activate/deactivate the plugin during deployment. Alternatively, you can also use the value passed in through `--stage` to control this option, [see example.](#disable-plugin-for-particular-environment) |
51
- | `monitors` | When defined, the Datadog plugin will configure monitors for the deployed function. You must also have `monitorsApiKey` and `monitorsAppKey` defined. To learn how to define monitors, see [To Enable and Configure a Recommended Serverless Monitor.](#to-enable-and-configure-a-recommended-serverless-monitor) |
52
- | `customHandler` | When set, the specified handler is set as the handler for all the functions. By deafult, the handler is set to `/opt/nodejs/node_modules/datadog-lambda-js/handler.handler` if `addLayers` is set to `true`, or `node_modules/datadog-lambda-js/dist/handler.handler` if `addLayers` is set to `false` |
34
+ | Parameter | Description |
35
+ | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
36
+ | `flushMetricsToLogs` | Send custom metrics by using logs with the Datadog Forwarder Lambda function (recommended). Defaults to `true`. If you disable this parameter, it's required to set `apiKey` (or `apiKMSKey` if encrypted). `flushMetricsToLogs` is ignored when `addExtension` is true. |
37
+ | `site` | Set which Datadog site to send data, this is only used when `flushMetricsToLogs` is `false` or `addExtension` is `true`. Possible values are `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`, `us5.datadoghq.com`, and `ddog-gov.com`. The default is `datadoghq.com`. |
38
+ | `apiKey` | Datadog API Key, only needed when `flushMetricsToLogs` is `false` or `addExtension` is `true`. Defining `apiKey` will add the Datadog API key directly to your Lambda functions as an environment variable. For more information about getting a Datadog API key, see the [API key documentation][3]. |
39
+ | `apiKMSKey` | Datadog API Key encrypted using KMS. Use this parameter in place of `apiKey` when `flushMetricsToLogs` is `false` or `addExtension` is `true`, and you are using KMS encryption. Defining `apiKMSKey` will add the Datadog API Key directly to your Lambda functions as an environment variable. |
40
+ | `captureLambdaPayload` | (Experimental) This optional setting configures Datadog ingestion for incoming and outgoing AWS Lambda payloads. Function request and response values are added as part of outgoing APM spans sent to Datadog, and require Datadog APM to be configured on your function. Obfuscation of fields in the Lambda payload is available via the `replace_tags` block within `apm_config` settings in [datadog.yaml.][12] Defaults to `false`. |
41
+ | `monitorsApiKey` | Datadog API Key. Only needed when using plugin to create monitors for your functions and when `monitors` is defined. Separate from `apiKey` with your function, `monitorsApiKey` is only used to create monitors through the Datadog Monitors API. You may use the same API key for both `apiKey` and `monitorsApiKey`. |
42
+ | `monitorsAppKey` | Datadog Application Key. Only needed when using plugin to create monitors for your function and when `monitors` is defined. |
43
+ | `addLayers` | Whether to install the Datadog Lambda library as a layer. Defaults to `true`. Set to `false` when you plan to package the Datadog Lambda library to your function's deployment package on your own so that you can install a specific version of the Datadog Lambda library ([Python][4] or [Node.js][5]). |
44
+ | `addExtension` | Whether to install the Datadog Lambda Extension as a layer. Defaults to `false`. When enabled, it's required to set the `apiKey` (or `apiKMSKey`) parameter. Learn more about the Lambda Extension Layer [here][8]. Note: AWS only supports Lambda Extensions for [certain runtimes][9]. |
45
+ | `logLevel` | The log level, set to `DEBUG` for extended logging. |
46
+ | `enableXrayTracing` | Set `true` to enable X-Ray tracing on the Lambda functions and API Gateway integrations. Defaults to `false`. |
47
+ | `enableDDTracing` | Enable Datadog tracing on the Lambda function. Note: This applies only to integrations using the Datadog Extension. Defaults to `true`. |
48
+ | `enableDDLogs` | Enable Datadog log collection for the Lambda function. Note: This setting has no effect on logs sent via the Datadog Forwarder. Defaults to `true`. |
49
+ | `subscribeToApiGatewayLogs` | Enable automatic subscription of the Datadog Forwarder to API Gateway log groups. Defaults to `true`. |
50
+ | `subscribeToHttpApiLogs` | Enable automatic subscription of the Datadog Forwarder to Http-api log groups. Defaults to `true`. |
51
+ | `subscribeToWebsocketLogs` | Enable automatic subscription of the Datadog Forwarder to Websocket log groups. Defaults to `true`. |
52
+ | `forwarderArn` | Setting this parameter subscribes the given Datadog forwarder to the Lambda functions’ CloudWatch log groups. Required when `enableDDTracing` is set to `true` unless the subscription is otherwise applied. For example, if a Datadog Forwarder subscription is applied via Datadog's AWS Integration, then `forwarderArn` is not required. |
53
+ | `integrationTesting` | Set `true` when running integration tests. This will bypass the validation of the Forwarder ARN and the addition of Datadog Monitor output links. Defaults to `false`. |
54
+ | `enableTags` | When set, automatically tag the Lambda functions with the `service` and `env` tags using the `service` and `stage` values from the serverless application definition. It does NOT override if a `service` or `env` tag already exists. Defaults to `true`. |
55
+ | `injectLogContext` | When set, the lambda layer will automatically patch console.log with Datadog's tracing ids. Defaults to `true`. |
56
+ | `exclude` | When set, this plugin will ignore all specified functions. Use this parameter if you have any functions that should not include Datadog functionality. Defaults to `[]`. |
57
+ | `enabled` | When set to false, the Datadog plugin will stay inactive. Defaults to `true`. You can control this option using an environment variable, e.g. `enabled: ${strToBool(${env:DD_PLUGIN_ENABLED, true})}`, to activate/deactivate the plugin during deployment. Alternatively, you can also use the value passed in through `--stage` to control this option, [see example.](#disable-plugin-for-particular-environment) |
58
+ | `monitors` | When defined, the Datadog plugin will configure monitors for the deployed function. You must also have `monitorsApiKey` and `monitorsAppKey` defined. To learn how to define monitors, see [To Enable and Configure a Recommended Serverless Monitor.](#to-enable-and-configure-a-recommended-serverless-monitor) |
59
+ | `customHandler` | When set, the specified handler is set as the handler for all the functions. By deafult, the handler is set to `/opt/nodejs/node_modules/datadog-lambda-js/handler.handler` if `addLayers` is set to `true`, or `node_modules/datadog-lambda-js/dist/handler.handler` if `addLayers` is set to `false` |
53
60
 
54
61
  To use any of these parameters, add a `custom` > `datadog` section to your `serverless.yml` similar to this example:
55
62
 
@@ -66,7 +73,7 @@ custom:
66
73
  enableXrayTracing: false
67
74
  enableDDTracing: true
68
75
  enableDDLogs: true
69
- subscribeToApiGatewayLogs: true
76
+ subscribeToAccessLogs: true
70
77
  forwarderArn: arn:aws:lambda:us-east-1:000000000000:function:datadog-forwarder
71
78
  enableTags: true
72
79
  injectLogContext: true
@@ -263,7 +270,7 @@ For product feedback and questions, join the `#serverless` channel in the [Datad
263
270
 
264
271
  Unless explicitly stated otherwise, all files in this repository are licensed under the Apache License Version 2.0.
265
272
 
266
- This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
273
+ This product includes software developed at Datadog (<https://www.datadoghq.com/>). Copyright 2021 Datadog, Inc.
267
274
 
268
275
  [1]: https://docs.datadoghq.com/serverless/installation/python/?tab=serverlessframework
269
276
  [2]: https://docs.datadoghq.com/serverless/installation/nodejs/?tab=serverlessframework
@@ -276,3 +283,4 @@ This product includes software developed at Datadog (https://www.datadoghq.com/)
276
283
  [9]: https://docs.aws.amazon.com/lambda/latest/dg/using-extensions.html
277
284
  [10]: https://github.com/DataDog/serverless-plugin-datadog/blob/master/CONTRIBUTING.md
278
285
  [11]: https://github.com/DataDog/serverless-plugin-datadog/blob/master/src/layers.json
286
+ [12]: https://docs.datadoghq.com/tracing/setup_overview/configure_data_security/?tab=mongodb#replace-rules-for-tag-filtering
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "serverless-plugin-datadog",
3
- "version": "3.0.0",
3
+ "version": "3.1.2",
4
4
  "description": "Serverless plugin to automatically instrument python and node functions with datadog tracing",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": "https://github.com/DataDog/serverless-plugin-datadog",
package/dist/src/env.d.ts CHANGED
@@ -5,6 +5,7 @@ export interface Configuration {
5
5
  addLayers: boolean;
6
6
  apiKey?: string;
7
7
  apiKMSKey?: string;
8
+ captureLambdaPayload?: boolean;
8
9
  monitorsApiKey?: string;
9
10
  monitorsAppKey?: string;
10
11
  site: string;
@@ -25,9 +26,8 @@ export interface Configuration {
25
26
  [key: string]: any;
26
27
  };
27
28
  }[];
28
- subscribeToApiGatewayLogs: boolean;
29
- subscribeToHttpApiLogs: boolean;
30
- subscribeToWebsocketLogs: boolean;
29
+ subscribeToAccessLogs: boolean;
30
+ subscribeToExecutionLogs: boolean;
31
31
  customHandler?: string;
32
32
  }
33
33
  export declare const defaultConfiguration: Configuration;
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,OAAO,MAAM,4BAA4B,CAAC;AAEjD,MAAM,WAAW,aAAa;IAE5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,SAAS,EAAE,OAAO,CAAC;IAEnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAE7B,kBAAkB,EAAE,OAAO,CAAC;IAE5B,iBAAiB,EAAE,OAAO,CAAC;IAE3B,eAAe,EAAE,OAAO,CAAC;IAEzB,YAAY,EAAE,OAAO,CAAC;IAEtB,YAAY,EAAE,OAAO,CAAC;IAGtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IAInB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAI7B,UAAU,EAAE,OAAO,CAAC;IAEpB,gBAAgB,EAAE,OAAO,CAAC;IAG1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,QAAQ,CAAC,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG;YAAE,CAAC,GAAG,EAAE,MAAM,GA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C;IAInB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAI7B,UAAU,EAAE,OAAO,CAAC;IAEpB,gBAAgB,EAAE,OAAO,CAAC;IAG1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,QAAQ,CAAC,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;SAAE,CAAA;KAAE,EAAE,CAAC;IAGtD,qBAAqB,EAAE,OAAO,CAAC;IAE/B,wBAAwB,EAAE,OAAO,CAAC;IAGlC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAYD,eAAO,MAAM,oBAAoB,EAAE,aAgBlC,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,QAgClF;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,aAAa,CAczD;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,QAgB3D;AAiBD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,WAehD"}
package/dist/src/env.js CHANGED
@@ -17,6 +17,7 @@ const logForwardingEnvVar = "DD_FLUSH_TO_LOG";
17
17
  const ddTracingEnabledEnvVar = "DD_TRACE_ENABLED";
18
18
  const logInjectionEnvVar = "DD_LOGS_INJECTION";
19
19
  const ddLogsEnabledEnvVar = "DD_SERVERLESS_LOGS_ENABLED";
20
+ const ddCaptureLambdaPayloadEnvVar = "DD_CAPTURE_LAMBDA_PAYLOAD";
20
21
  exports.defaultConfiguration = {
21
22
  addLayers: true,
22
23
  flushMetricsToLogs: true,
@@ -29,10 +30,10 @@ exports.defaultConfiguration = {
29
30
  injectLogContext: true,
30
31
  exclude: [],
31
32
  integrationTesting: false,
32
- subscribeToApiGatewayLogs: true,
33
- subscribeToHttpApiLogs: true,
34
- subscribeToWebsocketLogs: true,
33
+ subscribeToAccessLogs: true,
34
+ subscribeToExecutionLogs: false,
35
35
  enableDDLogs: true,
36
+ captureLambdaPayload: false,
36
37
  };
37
38
  function setEnvConfiguration(config, handlers) {
38
39
  handlers.forEach(({ handler }) => {
@@ -63,6 +64,9 @@ function setEnvConfiguration(config, handlers) {
63
64
  if (config.enableDDLogs !== undefined && environment[ddLogsEnabledEnvVar] === undefined) {
64
65
  environment[ddLogsEnabledEnvVar] = config.enableDDLogs;
65
66
  }
67
+ if (environment[ddCaptureLambdaPayloadEnvVar] === undefined) {
68
+ environment[ddCaptureLambdaPayloadEnvVar] = config.captureLambdaPayload;
69
+ }
66
70
  });
67
71
  }
68
72
  exports.setEnvConfiguration = setEnvConfiguration;
@@ -1 +1 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA4DH,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAC/C,MAAM,YAAY,GAAG,YAAY,CAAC;AAClC,MAAM,eAAe,GAAG,gBAAgB,CAAC;AACzC,MAAM,aAAa,GAAG,SAAS,CAAC;AAChC,MAAM,cAAc,GAAG,cAAc,CAAC;AACtC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAC9C,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAClD,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAC/C,MAAM,mBAAmB,GAAG,4BAA4B,CAAC;AAE5C,QAAA,oBAAoB,GAAkB;IACjD,SAAS,EAAE,IAAI;IACf,kBAAkB,EAAE,IAAI;IACxB,QAAQ,EAAE,SAAS;IACnB,IAAI,EAAE,eAAe;IACrB,iBAAiB,EAAE,KAAK;IACxB,eAAe,EAAE,IAAI;IACrB,YAAY,EAAE,KAAK;IACnB,UAAU,EAAE,IAAI;IAChB,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE,EAAE;IACX,kBAAkB,EAAE,KAAK;IACzB,yBAAyB,EAAE,IAAI;IAC/B,sBAAsB,EAAE,IAAI;IAC5B,wB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;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAgB,gBAAgB,CAAC,OAAgB;IAC/C,MAAM,OAAO,GAA0B,OAAe,CAAC,OAAO,CAAC;IAC/D,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,OAAO,KAAK,CAAC;KACd;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC1B,gCAAgC;QAChC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,iBAAiB,CAAC,KAAK,SAAS,CAAC;KAC7E;IACD,qCAAqC;IACrC,MAAM,OAAO,GAA0B,OAAe,CAAC,OAAO,CAAC,OAAO,CAAC;IACvE,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,OAAO,KAAK,CAAC;KACd;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,iBAAiB,CAAC,KAAK,SAAS,CAAC;AAC9E,CAAC;AAfD,4CAeC"}
@@ -4,14 +4,23 @@ import Aws = require("serverless/plugins/aws/provider/awsProvider");
4
4
  interface ForwarderConfigs {
5
5
  AddExtension: boolean;
6
6
  IntegrationTesting: boolean | undefined;
7
- SubToApiGatewayLogGroup: boolean;
8
- SubToHttpApiLogGroup: boolean;
9
- SubToWebsocketLogGroup: boolean;
7
+ SubToAccessLogGroups: boolean;
8
+ SubToExecutionLogGroups: boolean;
10
9
  }
10
+ declare type SubLogsConfig = boolean | {
11
+ accessLogging: boolean | undefined;
12
+ executionLogging: boolean | undefined;
13
+ } | undefined;
14
+ declare type LogsConfig = {
15
+ restApi: SubLogsConfig;
16
+ httpApi: SubLogsConfig;
17
+ websocket: SubLogsConfig;
18
+ } | undefined;
11
19
  export interface CloudFormationObjectArn {
12
20
  "Fn::Sub"?: string;
13
21
  "arn:aws"?: string;
14
22
  }
23
+ export declare function addExecutionLogGroupsAndSubscriptions(service: Service, aws: Aws, functionArn: CloudFormationObjectArn | string): Promise<void>;
15
24
  export declare function addCloudWatchForwarderSubscriptions(service: Service, aws: Aws, functionArn: CloudFormationObjectArn | string, forwarderConfigs: ForwarderConfigs, handlers: FunctionInfo[]): Promise<string[]>;
16
25
  export declare function canSubscribeLogGroup(aws: Aws, logGroupName: string, expectedSubName: string): Promise<boolean>;
17
26
  export declare function describeSubscriptionFilters(aws: Aws, logGroupName: string): Promise<{
@@ -23,5 +32,6 @@ export declare function describeSubscriptionFilters(aws: Aws, logGroupName: stri
23
32
  logGroupName: string;
24
33
  roleArn: string;
25
34
  }[]>;
35
+ export declare function isLogsConfig(obj: any): obj is LogsConfig;
26
36
  export {};
27
37
  //# sourceMappingURL=forwarder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"forwarder.d.ts","sourceRoot":"","sources":["../../src/forwarder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,OAAO,MAAM,4BAA4B,CAAC;AACjD,OAAO,GAAG,GAAG,QAAQ,6CAA6C,CAAC,CAAC;AAqBpE,UAAU,gBAAgB;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,kBAAkB,EAAE,OAAO,GAAG,SAAS,CAAC;IACxC,uBAAuB,EAAE,OAAO,CAAC;IACjC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,sBAAsB,EAAE,OAAO,CAAC;CACjC;AAcD,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAmBD,wBAAsB,mCAAmC,CACvD,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,uBAAuB,GAAG,MAAM,EAC7C,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,YAAY,EAAE,qBAmDzB;AAED,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EA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AY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,oBAejG;AAED,wBAAsB,2BAA2B,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM;;;;;;;;KAc/E;AAyHD,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,UAAU,CAuBxD"}
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.describeSubscriptionFilters = exports.canSubscribeLogGroup = exports.addCloudWatchForwarderSubscriptions = void 0;
12
+ exports.isLogsConfig = exports.describeSubscriptionFilters = exports.canSubscribeLogGroup = exports.addCloudWatchForwarderSubscriptions = exports.addExecutionLogGroupsAndSubscriptions = void 0;
13
13
  const logGroupKey = "AWS::Logs::LogGroup";
14
14
  const logGroupSubscriptionKey = "AWS::Logs::SubscriptionFilter";
15
15
  const maxAllowableLogGroupSubscriptions = 2;
@@ -20,6 +20,10 @@ class DatadogForwarderNotFoundError extends Error {
20
20
  this.message = message;
21
21
  }
22
22
  }
23
+ const REST_EXECUTION_LOG_GROUP_KEY = "RestExecutionLogGroup";
24
+ const REST_EXECUTION_SUBSCRIPTION_KEY = "RestExecutionLogGroupSubscription";
25
+ const WEBSOCKETS_EXECUTION_LOG_GROUP_KEY = "WebsocketsExecutionLogGroup";
26
+ const WEBSOCKETS_EXECUTION_SUBCRIPTION_KEY = "WebsocketsExecutionLogGroupSubscription";
23
27
  function isLogGroup(value) {
24
28
  return value.Type === logGroupKey;
25
29
  }
@@ -38,6 +42,35 @@ function validateForwarderArn(aws, functionArn) {
38
42
  }
39
43
  });
40
44
  }
45
+ function addExecutionLogGroupsAndSubscriptions(service, aws, functionArn) {
46
+ var _a, _b;
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const extendedProvider = (_a = service.provider) === null || _a === void 0 ? void 0 : _a.logs;
49
+ if (!isLogsConfig(extendedProvider)) {
50
+ return;
51
+ }
52
+ const resources = (_b = service.provider.compiledCloudFormationTemplate) === null || _b === void 0 ? void 0 : _b.Resources;
53
+ if (restExecutionLoggingIsEnabled(extendedProvider)) {
54
+ // create log group
55
+ const logGroupName = yield createRestExecutionLogGroupName(aws);
56
+ const executionLogGroupName = addExecutionLogGroup(logGroupName);
57
+ resources[REST_EXECUTION_LOG_GROUP_KEY] = executionLogGroupName;
58
+ // add subscription
59
+ const executionSubscription = subscribeToExecutionLogGroup(functionArn, REST_EXECUTION_LOG_GROUP_KEY);
60
+ resources[REST_EXECUTION_SUBSCRIPTION_KEY] = executionSubscription;
61
+ }
62
+ if (websocketExecutionLoggingIsEnabled(extendedProvider)) {
63
+ // create log group
64
+ const logGroupName = yield createWebsocketExecutionLogGroupName(aws);
65
+ const executionLogGroupName = addExecutionLogGroup(logGroupName);
66
+ // add subscription
67
+ resources[WEBSOCKETS_EXECUTION_LOG_GROUP_KEY] = executionLogGroupName;
68
+ const executionSubscription = subscribeToExecutionLogGroup(functionArn, WEBSOCKETS_EXECUTION_LOG_GROUP_KEY);
69
+ resources[WEBSOCKETS_EXECUTION_SUBCRIPTION_KEY] = executionSubscription;
70
+ }
71
+ });
72
+ }
73
+ exports.addExecutionLogGroupsAndSubscriptions = addExecutionLogGroupsAndSubscriptions;
41
74
  function addCloudWatchForwarderSubscriptions(service, aws, functionArn, forwarderConfigs, handlers) {
42
75
  var _a;
43
76
  return __awaiter(this, void 0, void 0, function* () {
@@ -56,7 +89,7 @@ function addCloudWatchForwarderSubscriptions(service, aws, functionArn, forwarde
56
89
  yield validateForwarderArn(aws, functionArn);
57
90
  }
58
91
  for (const [name, resource] of Object.entries(resources)) {
59
- if (!shouldSubscribe(name, resource, forwarderConfigs, handlers)) {
92
+ if (!shouldSubscribe(name, resource, forwarderConfigs, handlers, service)) {
60
93
  continue;
61
94
  }
62
95
  const logGroupName = resource.Properties.LogGroupName;
@@ -74,17 +107,6 @@ function addCloudWatchForwarderSubscriptions(service, aws, functionArn, forwarde
74
107
  // Create subscriptions for each log group
75
108
  const subscription = subscribeToLogGroup(functionArn, name);
76
109
  resources[scopedSubName] = subscription;
77
- // Create the Execution log group for API Gateway logging manually so we can subscribe
78
- if (validateApiGatewaySubscription(resource, forwarderConfigs.SubToApiGatewayLogGroup)) {
79
- // add api gateway execution log group
80
- const executionLogGroup = createExecutionLogGroup(aws);
81
- const executionLogGroupKey = "ExecutionLogGroup";
82
- resources[executionLogGroupKey] = executionLogGroup;
83
- // add subscription to execution log group
84
- const executionSubscription = subscribeToExecutionLogGroup(functionArn);
85
- const executionSubscriptionKey = "ExecutionLogGroupSubscription";
86
- resources[executionSubscriptionKey] = executionSubscription;
87
- }
88
110
  }
89
111
  return errors;
90
112
  });
@@ -126,31 +148,43 @@ function describeSubscriptionFilters(aws, logGroupName) {
126
148
  }
127
149
  exports.describeSubscriptionFilters = describeSubscriptionFilters;
128
150
  // Helper functions to validate we have a particular log group and if we should subscribe to it
129
- function validateApiGatewaySubscription(resource, subscribe) {
130
- return resource.Properties.LogGroupName.startsWith("/aws/api-gateway/") && subscribe;
151
+ function validateRestApiSubscription(resource, subscribe, extendedProvider) {
152
+ return (restAccessLoggingIsEnabled(extendedProvider) &&
153
+ resource.Properties.LogGroupName.startsWith("/aws/api-gateway/") &&
154
+ subscribe);
131
155
  }
132
- function validateHttpApiSubscription(resource, subscribe) {
133
- return resource.Properties.LogGroupName.startsWith("/aws/http-api/") && subscribe;
156
+ function validateHttpApiSubscription(resource, subscribe, extendedProvider) {
157
+ return (httpAccessLoggingIsEnabled(extendedProvider) &&
158
+ resource.Properties.LogGroupName.startsWith("/aws/http-api/") &&
159
+ subscribe);
134
160
  }
135
- function validateWebsocketSubscription(resource, subscribe) {
136
- return resource.Properties.LogGroupName.startsWith("/aws/websocket/") && subscribe;
161
+ function validateWebsocketSubscription(resource, subscribe, extendedProvider) {
162
+ return (websocketAccessLoggingIsEnabled(extendedProvider) &&
163
+ resource.Properties.LogGroupName.startsWith("/aws/websocket/") &&
164
+ subscribe);
137
165
  }
138
- function shouldSubscribe(resourceName, resource, forwarderConfigs, handlers) {
166
+ function shouldSubscribe(resourceName, resource, forwarderConfigs, handlers, service) {
167
+ var _a;
168
+ const extendedProvider = (_a = service.provider) === null || _a === void 0 ? void 0 : _a.logs;
139
169
  if (!isLogGroup(resource)) {
140
170
  return false;
141
171
  }
172
+ // we don't want to run the shouldSubscribe validation on execution log groups since we manually add those.
173
+ if (typeof resource.Properties.LogGroupName !== "string") {
174
+ return false;
175
+ }
142
176
  // if the extension is enabled, we don't want to subscribe to lambda log groups
143
177
  if (forwarderConfigs.AddExtension &&
144
- !(validateApiGatewaySubscription(resource, forwarderConfigs.SubToApiGatewayLogGroup) ||
145
- validateHttpApiSubscription(resource, forwarderConfigs.SubToHttpApiLogGroup) ||
146
- validateWebsocketSubscription(resource, forwarderConfigs.SubToWebsocketLogGroup))) {
178
+ !(validateRestApiSubscription(resource, forwarderConfigs.SubToAccessLogGroups, extendedProvider) ||
179
+ validateHttpApiSubscription(resource, forwarderConfigs.SubToAccessLogGroups, extendedProvider) ||
180
+ validateWebsocketSubscription(resource, forwarderConfigs.SubToAccessLogGroups, extendedProvider))) {
147
181
  return false;
148
182
  }
149
183
  // if the extension is disabled, we should subscribe to lambda log groups
150
184
  if (!(resource.Properties.LogGroupName.startsWith("/aws/lambda/") ||
151
- validateApiGatewaySubscription(resource, forwarderConfigs.SubToApiGatewayLogGroup) ||
152
- validateHttpApiSubscription(resource, forwarderConfigs.SubToHttpApiLogGroup) ||
153
- validateWebsocketSubscription(resource, forwarderConfigs.SubToWebsocketLogGroup))) {
185
+ validateRestApiSubscription(resource, forwarderConfigs.SubToAccessLogGroups, extendedProvider) ||
186
+ validateHttpApiSubscription(resource, forwarderConfigs.SubToAccessLogGroups, extendedProvider) ||
187
+ validateWebsocketSubscription(resource, forwarderConfigs.SubToAccessLogGroups, extendedProvider))) {
154
188
  return false;
155
189
  }
156
190
  // If the log group does not belong to our list of handlers, we don't want to subscribe to it
@@ -171,30 +205,117 @@ function subscribeToLogGroup(functionArn, name) {
171
205
  };
172
206
  return subscription;
173
207
  }
174
- function createExecutionLogGroup(aws) {
175
- // Create the Execution log group for API Gateway logging manually
176
- const executionLogGroupName = {
177
- "Fn::Join": ["", ["API-Gateway-Execution-Logs_", { Ref: "ApiGatewayRestApi" }, "/", aws.getStage()]],
178
- };
208
+ function createRestExecutionLogGroupName(aws) {
209
+ return __awaiter(this, void 0, void 0, function* () {
210
+ return {
211
+ "Fn::Join": ["", ["API-Gateway-Execution-Logs_", { Ref: "ApiGatewayRestApi" }, "/", aws.getStage()]],
212
+ };
213
+ });
214
+ }
215
+ function createWebsocketExecutionLogGroupName(aws) {
216
+ return __awaiter(this, void 0, void 0, function* () {
217
+ return {
218
+ "Fn::Join": ["", ["/aws/apigateway/", { Ref: "WebsocketsApi" }, "/", aws.getStage()]],
219
+ };
220
+ });
221
+ }
222
+ function addExecutionLogGroup(logGroupName) {
223
+ // Create the Execution log group for API Gateway REST logging manually
179
224
  const executionLogGroup = {
180
225
  Type: "AWS::Logs::LogGroup",
181
226
  Properties: {
182
- LogGroupName: executionLogGroupName,
227
+ LogGroupName: logGroupName,
183
228
  },
184
229
  };
185
230
  return executionLogGroup;
186
231
  }
187
- function subscribeToExecutionLogGroup(functionArn) {
232
+ function subscribeToExecutionLogGroup(functionArn, executionLogGroupKey) {
188
233
  const executionSubscription = {
189
234
  Type: logGroupSubscriptionKey,
190
235
  Properties: {
191
236
  DestinationArn: functionArn,
192
237
  FilterPattern: "",
193
- LogGroupName: { Ref: "ExecutionLogGroup" },
238
+ LogGroupName: { Ref: executionLogGroupKey },
194
239
  },
195
240
  };
196
241
  return executionSubscription;
197
242
  }
243
+ function isLogsConfig(obj) {
244
+ if (typeof obj !== "object") {
245
+ return false;
246
+ }
247
+ if (obj.hasOwnProperty("restApi")) {
248
+ if (!isSubLogsConfig(obj.restApi)) {
249
+ return false;
250
+ }
251
+ }
252
+ if (obj.hasOwnProperty("httpApi")) {
253
+ if (!isSubLogsConfig(obj.httpApi)) {
254
+ return false;
255
+ }
256
+ }
257
+ if (obj.hasOwnProperty("websocket")) {
258
+ if (!isSubLogsConfig(obj.websocket)) {
259
+ return false;
260
+ }
261
+ }
262
+ return true;
263
+ }
264
+ exports.isLogsConfig = isLogsConfig;
265
+ function isSubLogsConfig(obj) {
266
+ if (typeof obj === "boolean") {
267
+ return true;
268
+ }
269
+ if (typeof obj !== "object") {
270
+ return false;
271
+ }
272
+ if (obj.hasOwnProperty("accessLogging")) {
273
+ if (typeof obj.accessLogging !== "boolean" && typeof obj.accessLogging !== undefined) {
274
+ return false;
275
+ }
276
+ }
277
+ if (obj.hasOwnProperty("executionLogging")) {
278
+ if (typeof obj.executionLogging !== "boolean" && typeof obj.executionLogging !== undefined) {
279
+ return false;
280
+ }
281
+ }
282
+ return true;
283
+ }
284
+ function restAccessLoggingIsEnabled(obj) {
285
+ var _a;
286
+ if ((obj === null || obj === void 0 ? void 0 : obj.restApi) === false) {
287
+ return false;
288
+ }
289
+ return (obj === null || obj === void 0 ? void 0 : obj.restApi) === true || ((_a = obj === null || obj === void 0 ? void 0 : obj.restApi) === null || _a === void 0 ? void 0 : _a.accessLogging) === true;
290
+ }
291
+ function restExecutionLoggingIsEnabled(obj) {
292
+ var _a;
293
+ if ((obj === null || obj === void 0 ? void 0 : obj.restApi) === false) {
294
+ return false;
295
+ }
296
+ return (obj === null || obj === void 0 ? void 0 : obj.restApi) === true || ((_a = obj === null || obj === void 0 ? void 0 : obj.restApi) === null || _a === void 0 ? void 0 : _a.executionLogging) === true;
297
+ }
298
+ function httpAccessLoggingIsEnabled(obj) {
299
+ var _a;
300
+ if ((obj === null || obj === void 0 ? void 0 : obj.httpApi) === false) {
301
+ return false;
302
+ }
303
+ return (obj === null || obj === void 0 ? void 0 : obj.httpApi) === true || ((_a = obj === null || obj === void 0 ? void 0 : obj.httpApi) === null || _a === void 0 ? void 0 : _a.accessLogging) === true;
304
+ }
305
+ function websocketAccessLoggingIsEnabled(obj) {
306
+ var _a;
307
+ if ((obj === null || obj === void 0 ? void 0 : obj.websocket) === false) {
308
+ return false;
309
+ }
310
+ return (obj === null || obj === void 0 ? void 0 : obj.websocket) === true || ((_a = obj === null || obj === void 0 ? void 0 : obj.websocket) === null || _a === void 0 ? void 0 : _a.accessLogging) === true;
311
+ }
312
+ function websocketExecutionLoggingIsEnabled(obj) {
313
+ var _a;
314
+ if ((obj === null || obj === void 0 ? void 0 : obj.websocket) === false) {
315
+ return false;
316
+ }
317
+ return (obj === null || obj === void 0 ? void 0 : obj.websocket) === true || ((_a = obj === null || obj === void 0 ? void 0 : obj.websocket) === null || _a === void 0 ? void 0 : _a.executionLogging) === true;
318
+ }
198
319
  // Created from https://github.com/serverless/serverless/blob/master/lib/plugins/aws/lib/naming.js#L125-L127
199
320
  // Skipped lodash because Lambda Function Names can't include unicode chars or symbols
200
321
  function getLogGroupLogicalId(functionName) {
@@ -1 +1 @@
1
- {"version":3,"file":"forwarder.js","sourceRoot":"","sources":["../../src/forwarder.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAC1C,MAAM,uBAAuB,GAAG,+BAA+B,CAAC;AAChE,MAAM,iCAAiC,GAAW,CAAC,CAAC;AAEpD,MAAM,6BAA8B,SAAQ,KAAK;IAC/C,YAAY,OAAe;QACzB,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAkCD,SAAS,UAAU,CAAC,KAAU;IAC5B,OAAO,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,SAAe,oBAAoB,CAAC,GAAQ,EAAE,WAA6C;;QACzF,IAAI;YACF,MAAM,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,aAAa,EAAE,EAA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