-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(aws-appmesh): adds access logging configuration to Virtual Nodes #10490
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e183e79
feat(aws-appmesh): adds access logging configuration to virtual nodes
6ef47f2
Reworks the AcessLog class to use bind methods to future proof for mu…
734c731
Merge branch 'master' into feature/accesslogging
dfezzie 76f97c2
Changes bind method to use the CFN property for access logging
f878242
Add use of the access log property to the README
bada0e1
Merge branch 'master' into feature/accesslogging
mergify[bot] 7788b20
Remove the default access logging config from the ECS patterns integ
a8ac2ca
Merge branch 'master' into feature/accesslogging
dfezzie bb9e105
Merge branch 'master' into feature/accesslogging
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ import * as cdk from '@aws-cdk/core'; | |
import { Construct } from 'constructs'; | ||
import { CfnVirtualNode } from './appmesh.generated'; | ||
import { IMesh } from './mesh'; | ||
import { HealthCheck, PortMapping, Protocol, VirtualNodeListener } from './shared-interfaces'; | ||
import { AccessLog, HealthCheck, PortMapping, Protocol, VirtualNodeListener } from './shared-interfaces'; | ||
import { IVirtualService } from './virtual-service'; | ||
|
||
/** | ||
|
@@ -90,6 +90,13 @@ export interface VirtualNodeBaseProps { | |
* @default - No listeners | ||
*/ | ||
readonly listener?: VirtualNodeListener; | ||
|
||
/** | ||
* Access Logging Configuration for the virtual node | ||
* | ||
* @default - No access logging | ||
*/ | ||
readonly accessLog?: AccessLog; | ||
} | ||
|
||
/** | ||
|
@@ -252,6 +259,7 @@ export class VirtualNode extends VirtualNodeBase { | |
|
||
this.addBackends(...props.backends || []); | ||
this.addListeners(...props.listener ? [props.listener] : []); | ||
const accessLogging = props.accessLog?.bind(this); | ||
|
||
const node = new CfnVirtualNode(this, 'Resource', { | ||
virtualNodeName: this.physicalName, | ||
|
@@ -267,13 +275,9 @@ export class VirtualNode extends VirtualNodeBase { | |
attributes: renderAttributes(props.cloudMapServiceInstanceAttributes), | ||
} : undefined, | ||
}, | ||
logging: { | ||
accessLog: { | ||
file: { | ||
path: '/dev/stdout', | ||
}, | ||
}, | ||
}, | ||
logging: accessLogging !== undefined ? { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you take my suggestion from above, this code should be simplified greatly 🙂. |
||
accessLog: accessLogging.virtualNodeAccessLog, | ||
} : undefined, | ||
}, | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would defaulting the
filePath
to/dev/stdout
be reasonable? It's the most common configuration we expect for folks using access logs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me ask you this.
Is it reasonable to leave this property unset (by that I mean
null
, as this property is optional in CloudFormation)? Is it a legitimate thing that customers might want to do?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path itself cannot be
null
(required in CFN: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appmesh-virtualnode-fileaccesslog.html). However, nulling the access log field in total is acceptable, and just means that no access logging will be configured for the resourceThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, is it reasonable for a customer to want to turn off logging by setting this (entire) property to
null
? Because if it is, we need to to take this requirement into account when designing this functionality.I see 2 ways of allowing that:
null
through CloudFormation).AccessLog
static factory method likenone
:which will set this field in the implementation of
VirtualNode
tonull
. In this case, keep the default for this field same it is today (so,{ file: { path: '/dev/stdout' } }
).Which one to choose between the two (assuming you're both on-board with the "union-like" approach here) I think depends on what you see the common case being. If
file: { path: '/dev/stdout' }
is a sensible default that many customers will be happy with, I would go with nr 2. If disabling logging is a common thing that a lot customers want (for example: does it have some cost implications?), though, I would go with nr 1.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Virtual Nodes, wouldn't the equivalent to having no access logging be:
Then if you wanted to enable the default access logging you could do something like:
or are the two equivalent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're talking about 2 different defaults here 🙂.
Today, this:
will result in the CDK default for logging of
{ file: { path: '/dev/stdout' } }
. I believe we're discussing in this comment whether to keep this default, or to get rid of it (see @bcelenza's original comment).If you do this:
you will get the service default instead, which I believe is "no logging is enabled" (but I'm sure you know it better than I do 🙂)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, there are actually two questions here:
/dev/stdout
?Having given this some thought, my view is the answer to both is no. With
/dev/stdout
, the access logs are mixed in with the logs from the proxy process, so I think it's important folks understand the impact of that (namely they need to parse two formats from the same sink). Also,/dev/stdout
is *nix specific and while we don't support Windows now, I can't definitively say we wouldn't support it in the future.