Skip to content

Commit c1a5cf3

Browse files
committed
feat: refactor constants for log event data and update Elasticsearch query
1 parent 140d872 commit c1a5cf3

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

user-auditor/src/main/java/com/utmstack/userauditor/service/elasticsearch/Constants.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ public final class Constants {
1111
// - Indices common fields
1212
// ----------------------------------------------------------------------------------
1313

14-
public static final String logxWineventlogEventDataTargetSidKeyword = "logx.wineventlog.event_data.TargetSid.keyword";
15-
public static final String logxWineventlogEventDataTargetUserSidKeyword = "logx.wineventlog.event_data.TargetUserSid.keyword";
16-
public static final String logxWineventlogEventDataMemberSidKeyword = "logx.wineventlog.event_data.MemberSid.keyword";
14+
public static final String LOG_WINLOG_EVENT_DATA_TARGET_USER_SID_KEYWORD = "log.winlogEventDataTargetUserSid.keyword";
1715

1816
/**
1917
* Environment variables

user-auditor/src/main/java/com/utmstack/userauditor/service/elasticsearch/ElasticsearchService.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ public <T> SearchResponse<T> searchBySid(String sid, String to, String from, Str
9090
private static BoolQuery.Builder getBuilder(String sid) {
9191
BoolQuery.Builder shouldList = new BoolQuery.Builder();
9292
shouldList.minimumShouldMatch("1");
93-
shouldList.should(f -> f.matchPhrase(m -> m.field(Constants.logxWineventlogEventDataTargetSidKeyword).query(sid)));
94-
shouldList.should(f -> f.matchPhrase(m -> m.field(Constants.logxWineventlogEventDataTargetUserSidKeyword).query(String.valueOf(sid))));
95-
shouldList.should(f -> f.matchPhrase(m -> m.field(Constants.logxWineventlogEventDataMemberSidKeyword).query(String.valueOf(sid))));
93+
shouldList.should(f -> f.matchPhrase(m -> m.field(Constants.LOG_WINLOG_EVENT_DATA_TARGET_USER_SID_KEYWORD).query(String.valueOf(sid))));
9694
return shouldList;
9795
}
9896

0 commit comments

Comments
 (0)