yl-backend/src/main/java/com/guwan/backend/elasticsearch/document/LogstashLog.java

89 lines
2.2 KiB
Java

package com.guwan.backend.elasticsearch.document;
import cn.easyes.annotation.IndexField;
import cn.easyes.annotation.IndexId;
import cn.easyes.annotation.IndexName;
import cn.easyes.annotation.rely.FieldType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
import java.time.Instant;
@Data
@IndexName("logstash-logs-*")
public class LogstashLog {
@IndexId
private String id;
@JsonProperty("@timestamp")
@IndexField(value = "@timestamp", fieldType = FieldType.DATE)
private Instant timestamp;
@JsonProperty("@version")
@IndexField(fieldType = FieldType.KEYWORD)
private String version;
@IndexField(fieldType = FieldType.TEXT)
private String message;
@IndexField(fieldType = FieldType.KEYWORD)
private String level;
@IndexField(fieldType = FieldType.LONG)
private Long level_value;
@IndexField(fieldType = FieldType.KEYWORD)
private String loggerName;
@IndexField(fieldType = FieldType.KEYWORD)
private String threadName;
@IndexField(fieldType = FieldType.TEXT)
private String stack_trace;
@IndexField(fieldType = FieldType.TEXT)
private String app_name;
@IndexField(fieldType = FieldType.KEYWORD)
private String host;
@IndexField(fieldType = FieldType.LONG)
private Long port;
@IndexField(fieldType = FieldType.TEXT)
private List<String> tags;
@Data
public static class GeoIP {
@IndexField(fieldType = FieldType.IP)
private String ip;
@IndexField(fieldType = FieldType.FLOAT)
private Float latitude;
@IndexField(fieldType = FieldType.FLOAT)
private Float longitude;
@IndexField(fieldType = FieldType.GEO_POINT)
private String location;
}
@IndexField(fieldType = FieldType.OBJECT)
private GeoIP geoip;
@JsonProperty("APP_NAME")
@IndexField(fieldType = FieldType.TEXT)
private String APP_NAME;
@JsonProperty("LOGSTASH_HOST")
@IndexField(fieldType = FieldType.TEXT)
private String LOGSTASH_HOST;
@JsonProperty("LOGSTASH_PORT")
@IndexField(fieldType = FieldType.TEXT)
private String LOGSTASH_PORT;
}