-
Notifications
You must be signed in to change notification settings - Fork 103
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
added a timestamp.timezone configuration in SplunkSinkConnectorConfig #403
Conversation
@@ -578,9 +578,12 @@ private void timestampExtraction(Event event) { | |||
log.warn("Could not set the time", e); | |||
} | |||
} else { | |||
SimpleDateFormat df = new SimpleDateFormat(connectorConfig.timestampFormat); | |||
SimpleDateFormat df = new SimpleDateFormat(connectorConfig.timestampFormat,Locale.ENGLISH); |
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.
Why do we need locale change?
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.
without Locale information, in my local build, I get failed from test proceed, because orginally locale set up from system(os) as ko_KR. so I get exception error like this "Unparseable date: "Jun 13 2010 23:11:52.454 UTC".
(there's a English Jun)
I believe that the timestamp format of testcode should be changed or this code needs to be added Locale.ENGLISH.
but that's not my testcode, so I will remove Locale.ENGLISH as it was
@@ -257,6 +257,7 @@ public void checkExtractedTimestamp() { | |||
config.put(SplunkSinkConnectorConfig.ENABLE_TIMESTAMP_EXTRACTION_CONF, String.valueOf(true)); | |||
config.put(SplunkSinkConnectorConfig.REGEX_CONF, "\\\"time\\\":\\s*\\\"(?<time>.*?)\""); | |||
config.put(SplunkSinkConnectorConfig.TIMESTAMP_FORMAT_CONF, "MMM dd yyyy HH:mm:ss.SSS zzz"); | |||
// config.put(SplunkSinkConnectorConfig.TIMESTAMP_TIMEZONE_CONF, ""); |
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 can remove it, as it defaults to empty string.
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.
yes I agree =)
Can you add test cases covering your config? |
@mo-mosh sync develop with your branch, it involves a fix for failing pipeline. |
@mo-mosh I can add test cases, if you're occupied. |
Hope you don't mind if I raise a PR against your repo? |
I don't mind =) and I'll update repo and gonna add test cases |
I updated the code like I added only what I need from the origin develop branch |
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.
@mo-mosh some comments.
config.put(SplunkSinkConnectorConfig.ENABLE_TIMESTAMP_EXTRACTION_CONF, String.valueOf(true)); | ||
config.put(SplunkSinkConnectorConfig.REGEX_CONF, "\\\"REQ_TIME\\\":\\s*\\\"(?<time>.*?)\""); | ||
config.put(SplunkSinkConnectorConfig.TIMESTAMP_FORMAT_CONF, "yyyyMMddHHmmssSSS"); | ||
config.put(SplunkSinkConnectorConfig.TIMESTAMP_TIMEZONE_CONF, "Asis/Seoul"); |
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.
config.put(SplunkSinkConnectorConfig.TIMESTAMP_TIMEZONE_CONF, "Asis/Seoul"); | |
config.put(SplunkSinkConnectorConfig.TIMESTAMP_TIMEZONE_CONF, "Asia/Seoul"); |
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.
Oh my typo 😭
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.
LGTM
I have the same issue "Add support for timezone override #398", so I added a timestamp.timezone.
as a default it's the UTC, but in my case I needed to change UTC to Asia/Seoul.