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
NIFI-8175: Add WindowsEventLogReader controller service #4785
Conversation
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.
This looks like a straightforward implementation with helpful documentation and unit tests. See individual comments for a few questions and potential optimizations.
...serialization-services/src/main/java/org/apache/nifi/windowsevent/WindowsEventLogReader.java
Outdated
Show resolved
Hide resolved
...ization-services/src/main/java/org/apache/nifi/windowsevent/WindowsEventLogRecordReader.java
Outdated
Show resolved
Hide resolved
...ization-services/src/main/java/org/apache/nifi/windowsevent/WindowsEventLogRecordReader.java
Show resolved
Hide resolved
...ization-services/src/main/java/org/apache/nifi/windowsevent/WindowsEventLogRecordReader.java
Outdated
Show resolved
Hide resolved
...ization-services/src/main/java/org/apache/nifi/windowsevent/WindowsEventLogRecordReader.java
Outdated
Show resolved
Hide resolved
...ization-services/src/main/java/org/apache/nifi/windowsevent/WindowsEventLogRecordReader.java
Outdated
Show resolved
Hide resolved
...ization-services/src/main/java/org/apache/nifi/windowsevent/WindowsEventLogRecordReader.java
Outdated
Show resolved
Hide resolved
} else if (xmlEvent.isEndElement()) { | ||
final String contentToReturn = content.toString(); | ||
|
||
if (!StringUtils.isBlank(contentToReturn)) { |
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.
This could be replaced with the Apache Commons StringUtils.isNotBlank()
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.
True but I am using the nifi utils version of StringUtils
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.
Sounds good, thanks for the reply.
...ion-services/src/test/java/org/apache/nifi/windowsevent/TestWindowsEventLogRecordReader.java
Outdated
Show resolved
Hide resolved
|
||
@Test | ||
public void testSingleEvent() throws IOException, MalformedRecordException { | ||
InputStream is = new BufferedInputStream(new FileInputStream("src/test/resources/windowseventlog/single_event.xml")); |
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.
Is there a reason for using the src/test/resources
path as opposed to using something like TestWindowsEventLogRecordReader.class.getResourceAsStream("/windowseventlog/single_event.xml")
?
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.
Only for consistency, the src/test/resources thing appears all over the NiFi codebase so it's what I'm used to
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.
Thanks for the reply, that makes sense.
74ef5dc
to
7fc6ed8
Compare
Thanks for making the updates @mattyb149, looks good! +1 |
Thanks for the PR @mattyb149, merging into main. |
This closes apache#4785 Signed-off-by: David Handermann <exceptionfactory@apache.org>
This closes apache#4785 Signed-off-by: David Handermann <exceptionfactory@apache.org>
Thank you for submitting a contribution to Apache NiFi.
Please provide a short description of the PR here:
Description of PR
Adds a WindowsEventLogReader CS that assumes XML input (from ConsumeWindowsEventLog, ParseEvtx, etc.) and transforms it into NiFi Records. This can be used with any record-based processor.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically
main
)?Is your initial contribution a single, squashed commit? Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not
squash
or use--force
when pushing to allow for clean monitoring of changes.For code changes:
mvn -Pcontrib-check clean install
at the rootnifi
folder?LICENSE
file, including the mainLICENSE
file undernifi-assembly
?NOTICE
file, including the mainNOTICE
file found undernifi-assembly
?.displayName
in addition to .name (programmatic access) for each of the new properties?For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check GitHub Actions CI for build issues and submit an update to your PR as soon as possible.