-
Notifications
You must be signed in to change notification settings - Fork 38
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
Adding fields 'aws_log_group' and 'aws_log_stream' to flow log and raw log codecs #55
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,13 @@ | |
* </pre> | ||
*/ | ||
public class CloudWatchLogData { | ||
|
||
@JsonProperty("logEvents") | ||
public List<CloudWatchLogEvent> logEvents; | ||
|
||
@JsonProperty("logGroup") | ||
public String logGroup; | ||
|
||
@JsonProperty("logStream") | ||
public String logStream; | ||
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. Can this ever by 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. Looking at the documentation and example, there is nothing to suggest that this field is optional / might not be present in any situation. Additionally, in all of my testing to date it has never not been present. 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. ✅ |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ public CloudWatchFlowLogCodec(@Assisted Configuration configuration, @AWSObjectM | |
|
||
@Nullable | ||
@Override | ||
public Message decodeLogData(@Nonnull final CloudWatchLogEvent logEvent) { | ||
public Message decodeLogData(@Nonnull final CloudWatchLogEvent logEvent, @Nonnull final String logGroup, @Nonnull final String logStream) { | ||
try { | ||
final FlowLogMessage flowLogMessage = FlowLogMessage.fromLogEvent(logEvent); | ||
|
||
|
@@ -51,6 +51,8 @@ public Message decodeLogData(@Nonnull final CloudWatchLogEvent logEvent) { | |
flowLogMessage.getTimestamp() | ||
); | ||
result.addFields(buildFields(flowLogMessage)); | ||
result.addField("aws_log_group", logGroup); | ||
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. Please extract the key names as constants into the existing 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. I've extracted these fields to constants. |
||
result.addField("aws_log_stream", logStream); | ||
result.addField(AWS.SOURCE_GROUP_IDENTIFIER, true); | ||
|
||
return result; | ||
|
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.
Can this ever by
null
(i. e. not exist)?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.
Looking at the documentation and example, there is nothing to suggest that this field is optional / might not be present in any situation. Additionally, in all of my testing to date it has never not been present.
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.
✅