Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

METRON-838 Incorrect set of ts in FireEye parser #528

Closed
wants to merge 6 commits into from

Conversation

bjigmp
Copy link
Contributor

@bjigmp bjigmp commented Apr 13, 2017

Contributor Comments

Although log line is parsed (method getTimeStamp of BasicFireEyeParser class, line 120) and day/month/year are extracted ts is not set to correct value. It set in line 128 but with default null month, day and time

Pull Request Checklist

Thank you for submitting a contribution to Apache Metron (Incubating).
Please refer to our Development Guidelines for the complete guide to follow for contributions.
Please refer also to our Build Verification Guidelines for complete smoke testing guides.

In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:

For all changes:

  • Is there a JIRA ticket associated with this PR? If not one needs to be created at Metron Jira.
  • Does your PR title start with METRON-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 master)?

For code changes:

  • Have you included steps to reproduce the behavior or problem that is being changed or addressed?

  • Have you included steps or a guide to how the change may be verified and tested manually?

  • Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:

    mvn -q clean integration-test install && build_utils/verify_licenses.sh 
    
  • Have you written or updated unit tests and or integration tests to verify your changes?

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?

  • Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via site-book/target/site/index.html:

    cd site-book
    bin/generate-md.sh
    mvn site:site
    

Note:

Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
It is also recommened that travis-ci is set up for your personal repository such that your branches are built there before submitting a pull request.

@ottobackwards
Copy link
Contributor

Hi bjigmp!
Thanks for the contribution.
We have a template for our PR's, that help us review and accept them. This PR is missing that,
can you please add it in?

@cestella
Copy link
Member

Thanks for the contribution! Also, could you please close and reopen the PR? You hit an intermittent test failure and travis should try again.

@ottobackwards
Copy link
Contributor

I created a gist of the template that you can copy and paste.
Please go through and fill out the appropriate things.

https://gist.github.com/ottobackwards/9b7ea0689a79b9510c52ad49045aea7e

@bjigmp bjigmp closed this Apr 13, 2017
@bjigmp bjigmp reopened this Apr 13, 2017
@bjigmp
Copy link
Contributor Author

bjigmp commented Apr 13, 2017

Thanks @ottobackwards, Updated this PR. Are all checkboxes must be checked?

@ottobackwards
Copy link
Contributor

ottobackwards commented Apr 13, 2017

No just the appropriate ones you can see.
Having said that, all the items in the code changes section seem to be applicable to this. So if you have not done these things please do.

I don't see the steps to repo or test, although you have them checked as well

@ottobackwards
Copy link
Contributor

Hi, What is the status of this PR?

@bjigmp
Copy link
Contributor Author

bjigmp commented Jun 14, 2017

Hi Otto, sorry for delay. I did not have sample data so I was not able to provide reproducible steps or write unit/integration tests. But recently I found some sampledata for FireEye in metron-platform/metron-parsers/src/test/resources/logData/FireEyeParserTest.txt
So I'm going to write integration test and add to this PR

@ottobackwards
Copy link
Contributor

Thank you

@bjigmp
Copy link
Contributor Author

bjigmp commented Jun 21, 2017

Wrote test for FireEye and found that it uses ParserUtils.convertToEpoch that returns incorrect value.
Filed METRON-1003. Will create PR to fix this bug and then continue with this PR.

@justinleet
Copy link
Contributor

@bjigmp I just merged in #623, so you should be able to continue this now. Thanks again for the submissions!

@justinleet
Copy link
Contributor

@bjigmp When you have a chance, could you deconflict this?

JSONObject parsed = parser.parse(fireeyeMessage.getBytes()).get(0);
JSONParser parser = new JSONParser();
Map json = (Map) parser.parse(parsed.toJSONString());
long expectedTimestamp = ZonedDateTime.of(Year.now(UTC).getValue(), 3, 19, 5, 24, 39, 0, UTC).toInstant().toEpochMilli();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's incredibly minor (and optional), but we could just swap out the ZoneId.of("UTC") for ZoneOffset.UTC

At that point, this changes slightly, but still seems reasonable

    long expectedTimestamp = ZonedDateTime.of(
        Year.now(ZoneOffset.UTC).getValue(),
        3,
        19,
        5,
        24,
        39,
        0,
        ZoneOffset.UTC
    ).toInstant().toEpochMilli();

@justinleet
Copy link
Contributor

+1 to this. There's a review comment, but quite frankly I consider it optional. If @bjigmp doesn't want to make that change, I'm still good.

@bjigmp
Copy link
Contributor Author

bjigmp commented Aug 7, 2017

Thanks @justinleet. Changed to ZoneOffset.UTC

@asfgit asfgit closed this in b3148a1 Aug 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants