我在 Ubuntu 服务器上安装了 GrayLog2,并传输了一些消息。搜索 ElasticSearch REST 接口时显示的消息,我做错了什么?我试着用谷歌搜索,但看起来一切正常,我可能遗漏了一些东西,任何帮助将不胜感激,谢谢。
Log4j.xml
<appender name="graylog2" class="org.graylog2.log.GelfAppender">
<param name="graylogHost" value="10.2.100.65"/>
<param name="originHost" value="dev"/>
<param name="extractStacktrace" value="true"/>
<param name="addExtendedInformation" value="true"/>
<param name="facility" value="gelf-java"/>
<param name="Threshold" value="INFO"/>
<param name="additionalFields" value="{'environment': 'DEV', 'application': 'MyAPP'}"/>
</appender>
日志测试:
public class LogFormatTest {
protected transient Logger log;
@Before
public void init(){
log = Logger.getLogger(LogFormatTest.class);
}
private enum ItalianCars{
AlfaRomeo ,
Fiat ,
Abarth ,
BaselMotors ,
BEngineering ,
Centenari ,
Bertone ,
Casalini ,
Covini ,
DR ,
Effedi ,
Mazzanti ,
Ferrari ,
Fornasari ,
Giottiline ,
Lamborghini ,
Lancia ,
Maserati ,
Pagani ,
PicchioRacingCars
}
@Test
public void testme(){
ItalianCars[] enums = ItalianCars.values();
for(int i=1; i < 1000; i++){
String csv = CSVLine.create(' ').with(DateTime.now()).with(i).with(enums[i%enums.length].toString()).build();
log.info(csv);
}
}
}
弹性搜索:
GrayLog2 索引(显示 711 条消息):