New Log Type JSON format#465
Conversation
Signed-off-by: Petar Dzepina <petar.dzepina@gmail.com>
Signed-off-by: Petar Dzepina <petar.dzepina@gmail.com>
Signed-off-by: Petar Dzepina <petar.dzepina@gmail.com>
Signed-off-by: Petar Dzepina <petar.dzepina@gmail.com>
Signed-off-by: Subhobrata Dey <sbcd90@gmail.com>
Signed-off-by: Petar Dzepina <petar.dzepina@gmail.com>
Codecov Report
@@ Coverage Diff @@
## main #465 +/- ##
============================================
+ Coverage 28.21% 28.23% +0.02%
- Complexity 897 906 +9
============================================
Files 231 235 +4
Lines 9326 9443 +117
Branches 1074 1081 +7
============================================
+ Hits 2631 2666 +35
- Misses 6459 6545 +86
+ Partials 236 232 -4
|
Signed-off-by: Subhobrata Dey <sbcd90@gmail.com>
fix flaky tests
|
|
||
| for(Mapping m : mappings) { | ||
| out.writeString(m.getRawField()); | ||
| out.writeString(m.getEcs()); |
There was a problem hiding this comment.
can we use out.writeCollection method here?
|
|
||
| public class LogType implements Writeable, ToXContentObject { | ||
|
|
||
| private static final String ID = "id"; |
There was a problem hiding this comment.
can we add unit tests for this class similar to https://github.com/opensearch-project/common-utils/blob/main/src/test/kotlin/org/opensearch/commons/alerting/model/FindingTests.kt & https://github.com/opensearch-project/common-utils/blob/main/src/test/kotlin/org/opensearch/commons/alerting/model/WriteableTests.kt
| for(String category: ruleCategories){ | ||
| queryBackendMap.put(category, new OSQueryBackend(category, true, true)); | ||
| for(String category: ruleCategories) { | ||
| Map<String, String> fieldMappings = logTypeService.getRuleFieldMappings(category); |
There was a problem hiding this comment.
getRuleFieldMappings internally calls getAllLogTypes from BuiltinLogTypeLoader which internally calls loadBuiltinLogTypes.
Why do we need to load all log types & then filter for particular category in memory?
There was a problem hiding this comment.
Actual loading of logTypes from disk will be done only 1 time. I replaced getAllLogTypes with BuiltinLogTypeLoader.getLogTypeByName(logType) existing method.
Signed-off-by: Petar Dzepina <petar.dzepina@gmail.com>
Signed-off-by: Petar Dzepina <petar.dzepina@gmail.com>
Signed-off-by: Petar Dzepina <petar.dzepina@gmail.com>
Signed-off-by: Petar Dzepina <petar.dzepina@gmail.com>
* New Log Type JSON format Signed-off-by: Petar Dzepina <petar.dzepina@gmail.com> Co-authored-by: Subhobrata Dey <sbcd90@gmail.com> (cherry picked from commit faccf6c)
* New Log Type JSON format Signed-off-by: Petar Dzepina <petar.dzepina@gmail.com> Co-authored-by: Subhobrata Dey <sbcd90@gmail.com> (cherry picked from commit faccf6c)
Description
Issues Resolved
#459
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.