Skip to content

Commit

Permalink
Add ES support
Browse files Browse the repository at this point in the history
  • Loading branch information
YaSuenag committed Apr 23, 2017
1 parent db4d631 commit fbc0a6d
Show file tree
Hide file tree
Showing 12 changed files with 596 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.idea/workspace.xml
.idea/uiDesigner.xml
.idea/kotlinc.xml
.idea/libraries/

target/
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,33 @@ In addition, you have to add `tags` (`tg`) to log tags.
* You need to open `trace` level log (`gc+age=trace`).
* You can check age table when GC is invoked.

### Push log(s) to others

#### Push to Elasticsearch

You can push your log(s) to [Elasticsearch](https://www.elastic.co/products/elasticsearch).

1. [File] -> [Push logs] -> [Elasticsearch]
2. Set parameters:
* Host
* Hostname of Elasticsearch
* `localhost` is by default.
* Port
* HTTP port of Elasticsearch
* `9200` is by default.
* Timeout
* Timeout of HTTP access in ms
* `5000` is by default.
* Bulk count
* Number of logs per bulk request
* `1000` is by default.
3. Push [OK] button

You can use `kibana/export.json` to show your log(s) in [Kibana](https://www.elastic.co/products/kibana).
You need to import this file in Management menu of Kibana.

`export.json` provides one dashboards and four visualizes. They shows GC and Safepoint information.

## How to build

You have to use JDK 8 and JavaFX 8.
Expand Down
75 changes: 75 additions & 0 deletions kibana/export.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
[
{
"_id": "8a9186f0-2766-11e7-b1f2-7338db1374e6",
"_type": "dashboard",
"_source": {
"title": "UL View",
"hits": 0,
"description": "",
"panelsJSON": "[{\"col\":1,\"id\":\"07cd90d0-2732-11e7-9db5-6f16e614737c\",\"panelIndex\":1,\"row\":1,\"size_x\":6,\"size_y\":3,\"type\":\"visualization\"},{\"col\":7,\"id\":\"345e1360-2735-11e7-bae9-5df446f30cb3\",\"panelIndex\":2,\"row\":1,\"size_x\":6,\"size_y\":3,\"type\":\"visualization\"},{\"col\":1,\"id\":\"1eac1960-2733-11e7-9db5-6f16e614737c\",\"panelIndex\":3,\"row\":4,\"size_x\":6,\"size_y\":3,\"type\":\"visualization\"},{\"col\":7,\"id\":\"4572ac20-2766-11e7-b1f2-7338db1374e6\",\"panelIndex\":4,\"row\":4,\"size_x\":6,\"size_y\":3,\"type\":\"visualization\"}]",
"optionsJSON": "{\"darkTheme\":false}",
"uiStateJSON": "{\"P-3\":{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}},\"P-4\":{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}}",
"version": 1,
"timeRestore": false,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"filter\":[{\"query\":{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"*\"}}}]}"
}
}
},
{
"_id": "07cd90d0-2732-11e7-9db5-6f16e614737c",
"_type": "visualization",
"_source": {
"title": "GC Pause time",
"visState": "{\"aggs\":[{\"enabled\":true,\"id\":\"1\",\"params\":{\"field\":\"GCPauseTime\"},\"schema\":\"metric\",\"type\":\"max\"},{\"enabled\":true,\"id\":\"2\",\"params\":{\"customInterval\":\"2h\",\"extended_bounds\":{},\"field\":\"time\",\"interval\":\"auto\",\"min_doc_count\":1},\"schema\":\"segment\",\"type\":\"date_histogram\"}],\"listeners\":{},\"params\":{\"addLegend\":true,\"addTimeMarker\":false,\"addTooltip\":true,\"defaultYExtents\":false,\"legendPosition\":\"right\",\"mode\":\"stacked\",\"scale\":\"linear\",\"setYExtents\":false,\"times\":[]},\"title\":\"GC Pause time\",\"type\":\"histogram\"}",
"uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}",
"description": "",
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"index\":\"jvmul-*\",\"query\":{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"*\"}},\"filter\":[]}"
}
}
},
{
"_id": "345e1360-2735-11e7-bae9-5df446f30cb3",
"_type": "visualization",
"_source": {
"title": "Java Heap Usage",
"visState": "{\"title\":\"Java Heap Usage\",\"type\":\"line\",\"params\":{\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"showCircles\":true,\"interpolate\":\"linear\",\"scale\":\"linear\",\"drawLinesBetweenPoints\":true,\"radiusRatio\":9,\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"max\",\"schema\":\"metric\",\"params\":{\"field\":\"JavaHeapUsage\"}},{\"id\":\"2\",\"enabled\":true,\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"time\",\"interval\":\"auto\",\"customInterval\":\"2h\",\"min_doc_count\":1,\"extended_bounds\":{}}}],\"listeners\":{}}",
"uiStateJSON": "{}",
"description": "",
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"index\":\"jvmul-*\",\"query\":{\"query_string\":{\"query\":\"*\",\"analyze_wildcard\":true}},\"filter\":[]}"
}
}
},
{
"_id": "1eac1960-2733-11e7-9db5-6f16e614737c",
"_type": "visualization",
"_source": {
"title": "Top 5 GCCause",
"visState": "{\"title\":\"Top 5 GCCause\",\"type\":\"table\",\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMeticsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":false,\"totalFunc\":\"sum\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"GCCause\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\"}},{\"id\":\"3\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"GCPauseTime\"}}],\"listeners\":{}}",
"uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}",
"description": "",
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"index\":\"jvmul-*\",\"query\":{\"query_string\":{\"query\":\"*\",\"analyze_wildcard\":true}},\"filter\":[]}"
}
}
},
{
"_id": "4572ac20-2766-11e7-b1f2-7338db1374e6",
"_type": "visualization",
"_source": {
"title": "Top 5 Safepoints",
"visState": "{\"aggs\":[{\"enabled\":true,\"id\":\"1\",\"params\":{},\"schema\":\"metric\",\"type\":\"count\"},{\"enabled\":true,\"id\":\"2\",\"params\":{\"field\":\"Safepoint\",\"order\":\"desc\",\"orderBy\":\"1\",\"size\":5},\"schema\":\"bucket\",\"type\":\"terms\"}],\"listeners\":{},\"params\":{\"perPage\":10,\"showMeticsAtAllLevels\":false,\"showPartialRows\":false,\"showTotal\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"totalFunc\":\"sum\"},\"title\":\"Top 5 Safepoints\",\"type\":\"table\"}",
"uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}",
"description": "",
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"index\":\"jvmul-*\",\"query\":{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"*\"}},\"filter\":[]}"
}
}
}
]
36 changes: 35 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Copyright (C) 2016 Yasumasa Suenaga
Copyright (C) 2016-2017 Yasumasa Suenaga
This file is part of UL Viewer.
Expand Down Expand Up @@ -37,6 +37,19 @@
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>rest</artifactId>
<version>5.3.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.8</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
Expand All @@ -57,6 +70,8 @@
<archive>
<manifest>
<mainClass>com.javafx.main.Main</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>lib</classpathPrefix>
</manifest>
<manifestEntries>
<JavaFX-Version>8.0.40+</JavaFX-Version>
Expand All @@ -65,6 +80,25 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/distribution.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
62 changes: 62 additions & 0 deletions src/main/assembly/distribution.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Copyright (C) 2017 Yasumasa Suenaga
This file is part of UL Viewer.
UL Viewer is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
UL Viewer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with UL Viewer. If not, see <http://www.gnu.org/licenses/>.
-->

<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>bin</id>
<formats>
<format>dir</format>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>ulviewer</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${pom.basedir}</directory>
<outputDirectory>ulviewer</outputDirectory>
<includes>
<include>README.md</include>
</includes>
</fileSet>
<fileSet>
<directory>${pom.basedir}/kibana</directory>
<outputDirectory>ulviewer/kibana</outputDirectory>
<includes>
<include>*</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<unpack>false</unpack>
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>ulviewer/lib</outputDirectory>
</dependencySet>
</dependencySets>
</assembly>
9 changes: 4 additions & 5 deletions src/main/java/jp/dip/ysfactory/ulviewer/logdata/LogData.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016 Yasumasa Suenaga
* Copyright (C) 2016-2017 Yasumasa Suenaga
*
* This file is part of UL Viewer.
*
Expand All @@ -18,7 +18,6 @@
*/
package jp.dip.ysfactory.ulviewer.logdata;

import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
Expand All @@ -41,7 +40,7 @@ public class LogData {

private ZonedDateTime time;

private LocalDateTime utcTime;
private ZonedDateTime utcTime;

private double uptime;

Expand Down Expand Up @@ -95,7 +94,7 @@ public LogData(String logline, List<LogDecoration> decorations){
break;

case UTCTIME:
utcTime = LocalDateTime.parse(decorationStr, LOG_DATETIME_FORMATTER);
utcTime = ZonedDateTime.parse(decorationStr, LOG_DATETIME_FORMATTER);
break;

case UPTIME:
Expand Down Expand Up @@ -148,7 +147,7 @@ public ZonedDateTime getTime() {
return time;
}

public LocalDateTime getUtcTime() {
public ZonedDateTime getUtcTime() {
return utcTime;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016 Yasumasa Suenaga
* Copyright (C) 2016-2017 Yasumasa Suenaga
*
* This file is part of UL Viewer.
*
Expand All @@ -18,8 +18,6 @@
*/
package jp.dip.ysfactory.ulviewer.logdata;

import java.time.ZoneOffset;

public class LogTimeValue {

private final Number value;
Expand Down Expand Up @@ -61,7 +59,7 @@ public static LogTimeValue getLogTimeValue(LogData log, LogDecoration decoration
return new LogTimeValue(log.getTime().toInstant().toEpochMilli(), log.getTime().toString());

case UTCTIME:
return new LogTimeValue(log.getUtcTime().toInstant(ZoneOffset.UTC).toEpochMilli(), log.getUtcTime().toString());
return new LogTimeValue(log.getUtcTime().toInstant().toEpochMilli(), log.getUtcTime().toString());

case UPTIME:
return new LogTimeValue(log.getUptime(), log.getUptime() + "s");
Expand Down
Loading

0 comments on commit fbc0a6d

Please sign in to comment.