opt:优化日志查询
This commit is contained in:
@@ -24,21 +24,17 @@ import org.springframework.web.bind.annotation.*;
|
||||
public class EsLogController {
|
||||
private final EsLogService esLogService;
|
||||
|
||||
|
||||
@GetMapping("/labels/{type}")
|
||||
|
||||
public ResponseEntity<Object> labelsValues(@PathVariable String type) {
|
||||
return new ResponseEntity<>(esLogService.getLabelsValues(type), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/query")
|
||||
|
||||
public ResponseEntity<Object> queryAll(@RequestBody LogQuery query) {
|
||||
return new ResponseEntity<>(esLogService.query(query), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@DeleteMapping("/clearLogs")
|
||||
|
||||
public ResponseEntity<Object> clearLogs(@RequestBody LogQuery query) {
|
||||
esLogService.clearLogs(query);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.apache.lucene.queryparser.classic.QueryParser;
|
||||
import org.apache.lucene.search.*;
|
||||
import org.apache.lucene.store.FSDirectory;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.nl.common.utils.ApiDocScan;
|
||||
import org.nl.config.lucene.LuceneAppender;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.logging.service.EsLogService;
|
||||
@@ -24,13 +25,11 @@ import org.nl.modules.logging.service.dto.LogRepositoryDTO;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.wltea.analyzer.lucene.IKAnalyzer;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
@@ -70,11 +69,27 @@ public class LuceneLogServiceImpl implements EsLogService {
|
||||
@Override
|
||||
public JSONArray getLabelsValues(String type) {
|
||||
JSONArray result = new JSONArray();
|
||||
for (String v : INFO_LEVEL) {
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("label", v);
|
||||
item.put("value", v);
|
||||
result.add(item);
|
||||
switch (type){
|
||||
case "logLevel":
|
||||
for (String v : INFO_LEVEL) {
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("label", v);
|
||||
item.put("value", v);
|
||||
result.add(item);
|
||||
}
|
||||
break;
|
||||
case "interface":
|
||||
if (!CollectionUtils.isEmpty(ApiDocScan.Log_Url)){
|
||||
Set<String> strings = ApiDocScan.Log_Url.keySet();
|
||||
for (String label : strings) {
|
||||
String value = ApiDocScan.Log_Url.get(label);
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("label", label);
|
||||
item.put("value", value);
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ public class AcsUtil {
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@InterfaceLog
|
||||
public JSONObject notifyAcs3(String api, JSONArray list) {
|
||||
log.info("下发ACS参数----------------------------------------+" + api + ",---" + list.toString());
|
||||
//判断是否连接ACS系统
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
window.g = {
|
||||
dev: {
|
||||
VUE_APP_BASE_API: 'http://localhost:8020'
|
||||
VUE_APP_BASE_API: 'http://localhost:8013'
|
||||
},
|
||||
prod: {
|
||||
VUE_APP_BASE_API: 'http://localhost:8020'
|
||||
VUE_APP_BASE_API: 'http://localhost:8013'
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<el-select
|
||||
v-model="system"
|
||||
clearable
|
||||
style="width: 100px; height: 35px;top: -5px;"
|
||||
style="width: 100px; height: 35px;top: 0px;"
|
||||
placeholder="所属标签"
|
||||
>
|
||||
<el-option
|
||||
@@ -22,7 +22,7 @@
|
||||
<el-select
|
||||
v-model="logLevelValue"
|
||||
clearable
|
||||
style="width: 100px; height: 35px;top: -5px;"
|
||||
style="width: 10px; height: 35px;top: 0px;"
|
||||
placeholder="日志级别"
|
||||
>
|
||||
<el-option
|
||||
@@ -34,11 +34,26 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="接口">
|
||||
<el-select
|
||||
v-model="requestMethod"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 150px; height: 35px;top: 0px;"
|
||||
placeholder="接口"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in interfaces"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item >
|
||||
<el-input
|
||||
v-model="requestMethod"
|
||||
size="mini"
|
||||
placeholder="请输入内容"
|
||||
clearable
|
||||
placeholder="接口地址"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="关键字">
|
||||
@@ -200,6 +215,7 @@ export default {
|
||||
return {
|
||||
labelsOptions: [], // 所有标签和对应所有值数据
|
||||
systemOptions: [], // 所有标签和对应所有值数据
|
||||
interfaces: [], // 所有标签和对应所有值数据
|
||||
logLevelValue: '',
|
||||
system: '',
|
||||
timeRange: [],
|
||||
@@ -274,7 +290,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.initLabelsValues('logLevel')
|
||||
this.initLabelsValues('system')
|
||||
this.initLabelsValues('interface')
|
||||
},
|
||||
methods: {
|
||||
fontType(level) {
|
||||
@@ -294,8 +310,8 @@ export default {
|
||||
if (type === 'logLevel') {
|
||||
this.labelsOptions = res
|
||||
}
|
||||
if (type === 'system') {
|
||||
this.systemOptions = res
|
||||
if (type === 'interface') {
|
||||
this.interfaces = res
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ function resolve(dir) {
|
||||
}
|
||||
|
||||
const name = defaultSettings.title // 网址标题
|
||||
const port = 8013 // 端口配置
|
||||
const port = 8081 // 端口配置
|
||||
|
||||
// All configuration item explanations can be find in https://cli.vuejs.org/config/
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user