Class AccessLogFormat
factory methods for access log format.
Inheritance
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AccessLogFormat : DeputyBase
Syntax (vb)
Public Class AccessLogFormat
Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
AccessLogFormat.Custom(JSON.Stringify(new Dictionary<string, object> {
{ "requestId", AccessLogField.ContextRequestId() },
{ "sourceIp", AccessLogField.ContextIdentitySourceIp() },
{ "method", AccessLogField.ContextHttpMethod() },
{ "userContext", new Struct {
Sub = AccessLogField.ContextAuthorizerClaims("sub"),
Email = AccessLogField.ContextAuthorizerClaims("email")
} }
}));
Synopsis
Constructors
AccessLogFormat(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
AccessLogFormat(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Methods
Clf() | Generate Common Log Format. |
Custom(String) | Custom log format. |
JsonWithStandardFields(IJsonWithStandardFieldProps) | Access log will be produced in the JSON format with a set of fields most useful in the access log. |
ToString() | Output a format string to be used with CloudFormation. |
Constructors
AccessLogFormat(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected AccessLogFormat(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
AccessLogFormat(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected AccessLogFormat(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Methods
Clf()
Custom(String)
Custom log format.
public static AccessLogFormat Custom(string format)
Parameters
- format System.String
Returns
Remarks
You can create any log format string. You can easily get the $ context variable by using the methods of AccessLogField.
Examples
AccessLogFormat.Custom(JSON.Stringify(new Dictionary<string, object> {
{ "requestId", AccessLogField.ContextRequestId() },
{ "sourceIp", AccessLogField.ContextIdentitySourceIp() },
{ "method", AccessLogField.ContextHttpMethod() },
{ "userContext", new Struct {
Sub = AccessLogField.ContextAuthorizerClaims("sub"),
Email = AccessLogField.ContextAuthorizerClaims("email")
} }
}));
JsonWithStandardFields(IJsonWithStandardFieldProps)
Access log will be produced in the JSON format with a set of fields most useful in the access log.
public static AccessLogFormat JsonWithStandardFields(IJsonWithStandardFieldProps fields = null)
Parameters
- fields IJsonWithStandardFieldProps
Returns
Remarks
All fields are turned on by default with the option to turn off specific fields.
ToString()
Output a format string to be used with CloudFormation.
public override string ToString()
Returns
System.String