| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package com.demo.seecanalysisbackend.repository;
- import com.demo.seecanalysisbackend.model.LogEntry;
- import org.springframework.data.domain.Page;
- import org.springframework.data.domain.Pageable;
- import org.springframework.data.elasticsearch.annotations.Query;
- import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
- import org.springframework.stereotype.Repository;
- import java.time.LocalDateTime;
- import java.util.List;
- @Repository
- public interface LogEntryRepository extends ElasticsearchRepository<LogEntry, String> {
-
- Page<LogEntry> findByTimestampBetween(LocalDateTime startTime, LocalDateTime endTime, Pageable pageable);
-
- Page<LogEntry> findByTimestampBetweenAndLevelIn(LocalDateTime startTime, LocalDateTime endTime,
- List<String> levels, Pageable pageable);
-
- Page<LogEntry> findByTimestampBetweenAndApplicationIn(LocalDateTime startTime, LocalDateTime endTime,
- List<String> applications, Pageable pageable);
-
- List<LogEntry> findByTimestampBetweenAndLevel(LocalDateTime startTime, LocalDateTime endTime, String level);
-
- Page<LogEntry> findByTimestampBetweenAndBizName(LocalDateTime startTime, LocalDateTime endTime,
- String bizName, Pageable pageable);
-
- Page<LogEntry> findByTimestampBetweenAndBizNameIn(LocalDateTime startTime, LocalDateTime endTime,
- List<String> bizNames, Pageable pageable);
-
- @Query("{\"bool\": {\"must\": [{\"range\": {\"@timestamp\": {\"gte\": \"?0\", \"lte\": \"?1\"}}}, {\"multi_match\": {\"query\": \"?2\", \"fields\": [\"raw_message\", \"business_info\", \"method_location\", \"service_name\", \"trace_id\", \"bizName\"]}}]}}")
- Page<LogEntry> findByTimestampBetweenAndMessage(LocalDateTime startTime, LocalDateTime endTime,
- String message, Pageable pageable);
-
- @Query("{\"bool\": {\"must\": [{\"range\": {\"@timestamp\": {\"gte\": \"?0\", \"lte\": \"?1\"}}}, {\"term\": {\"log_level\": \"?2\"}}]}}")
- long countByTimestampBetweenAndLevel(LocalDateTime startTime, LocalDateTime endTime, String level);
-
- @Query("{\"bool\": {\"must\": [{\"range\": {\"@timestamp\": {\"gte\": \"?0\", \"lte\": \"?1\"}}}]}}")
- long countByTimestampBetween(LocalDateTime startTime, LocalDateTime endTime);
-
- @Query("{\"bool\": {\"must\": [{\"range\": {\"@timestamp\": {\"gte\": \"?0\", \"lte\": \"?1\"}}}, {\"term\": {\"bizName\": \"?2\"}}]}}")
- long countByTimestampBetweenAndBizName(LocalDateTime startTime, LocalDateTime endTime, String bizName);
-
- @Query("{\"bool\": {\"must\": [{\"range\": {\"@timestamp\": {\"gte\": \"?0\", \"lte\": \"?1\"}}}, {\"term\": {\"service_name\": \"?2\"}}]}}")
- Page<LogEntry> findByTimestampBetweenAndServiceName(LocalDateTime startTime, LocalDateTime endTime,
- String serviceName, Pageable pageable);
-
- @Query("{\"bool\": {\"must\": [{\"range\": {\"@timestamp\": {\"gte\": \"?0\", \"lte\": \"?1\"}}}, {\"term\": {\"trace_id\": \"?2\"}}]}}")
- Page<LogEntry> findByTimestampBetweenAndTraceId(LocalDateTime startTime, LocalDateTime endTime,
- String traceId, Pageable pageable);
- }
|