Skip to content

Commit d38004a

Browse files
authored
Merge pull request #11 from Toparvion/#10-log-download
#10-log-download
2 parents 2bec003 + ef841d1 commit d38004a

File tree

65 files changed

+1950
-509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1950
-509
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
memo.txt
1212
log-samples/
13-
/dist/deploy/
13+
/dist/deploy-*/
1414
application.log

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The tool is in trial stage now and is being tested by Russian speaking users. Th
44

55
# АнаЛóг
66
**АнаЛóг** - это основанное на [tail](https://ru.wikipedia.org/wiki/Tail) веб-приложение, позволяющее просматривать в реальном времени одновременно несколько логов с удаленных тестовых серверов.
7-
Основные особенности программы:
7+
Основные возможности программы:
88
* просмотр логов через веб браузер;
99
_не требуется инсталляция специального ПО на клиентских машинах_;
1010
* отображение новых записей в реальном времени;
@@ -19,6 +19,9 @@ _сообщение каждого уровня выводится в своем
1919
_можно объединить несколько файлов (в т.ч. с разных серверов) в один виртуальный лог, который будет выводиться в браузере со строгим соблюдением временной последовательности и целостности записей (в т.ч. многострочных);_
2020
* форматирование XML;
2121
_АнаЛóг распознает XML-документы, расставляет для них отступы (даже если изначально XML был однострочным) и подсвечивает их синтаксис;_
22+
* скачивание логов через браузер для открытия в текстовом редакторе;
23+
_АнаЛóг позволяет скачать текущий файл лога, даже если он находится на удаленном узле агента АнаЛога.
24+
При этом любой файл можно скачать как полностью, так и только последнюю его часть удобного размера._
2225

2326
### Как это работает?
2427
АнаЛóг - Java-приложение, поставляемое в виде монолитного JAR-модуля и пары сопутствующих текстовых файлов. Приложение должно запускаться на том сервере, логи которого необходимо просматривать. После запуска приложение поднимает на указанном в настройках порту веб-интерфейс, через который пользователи могут выбирать и просматривать логи. Когда пользователь выбирает лог, приложение начинает отслеживать обновления этого лога при помощи встроенной в ОС утилиты `tail` (для Windows поставляется отдельно). Всякий раз, когда в логе появляется новая запись, `tail` передает ее АнаЛогу, а тот - рассылает ее всем клиентам (браузерам), прослушивающим этот лог.
@@ -29,7 +32,7 @@ _АнаЛóг распознает XML-документы, расстав
2932
В такой схеме любой сервер АнаЛога может составлять композитный лог, включающий как локальные для него логи, так и удаленные, доступ к которым он получит через агентов. Получая данные из этих источников, сервер агрегирует их и рассылает всем клиентам (браузерам), прослушивающим композитный лог.
3033

3134
### Как установить и настроить?
32-
Ссылка для скачивания и инструкция по установке приведены на странице [релиза v0.8](https://github.com/Toparvion/analog/releases/tag/v0.8).
35+
Ссылка для скачивания и инструкция по установке приведены на странице [последнего релиза](https://github.com/Toparvion/analog/releases/latest).
3336
Пример и пояснения к параметрам конфигурации можно [посмотреть в Wiki](https://github.com/Toparvion/analog/wiki/%D0%9F%D1%80%D0%B8%D0%BC%D0%B5%D1%80-%D0%BA%D0%BE%D0%BD%D1%84%D0%B8%D0%B3%D1%83%D1%80%D0%B0%D1%86%D0%B8%D0%B8).
3437

3538
### Статус проекта

bin/webctl.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
componentName="analog"
44
debugPort=8084
55

6-
# Since default JDK on the server is JDK_1.6 we forcibly make JAVA_HOME to point to JDK_1.8
7-
#JAVA_HOME=/usr/jdk/jdk1.8.0_92
8-
JAVA_HOME=/pub/site/opt/jdk/jdk1.8.0_92
6+
# Since default JDK on the server is JDK_1.6 we forcibly make JAVA_HOME to point to JDK_1.9
7+
#JAVA_HOME=/usr/jdk/jdk-9.0.4
98

109
#Set APP_HOME to point on the application folder.
1110
DIR=`dirname $0`
@@ -17,7 +16,9 @@ PID_FILE=$APP_HOME/$componentName.pid
1716
JAVA_OPTS=`echo "
1817
-D_$componentName
1918
"`
20-
JAVA_OPTS="$JAVA_OPTS -Xmx256m -XX:MaxMetaspaceSize=256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$debugPort -XX:+HeapDumpOnOutOfMemoryError"
19+
JAVA_OPTS="$JAVA_OPTS -Xmx256m -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError"
20+
JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:$debugPort"
21+
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8"
2122

2223
if [ -x "$JAVA_HOME/bin/java" ]; then
2324
JAVA="$JAVA_HOME/bin/java"

build.gradle

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
buildscript {
22
ext {
3-
springBootVersion = '2.0.0.M7'
4-
springIntegrationVersion = '5.0.0.RELEASE'
3+
springBootVersion = '2.0.1.RELEASE'
4+
springIntegrationVersion = '5.0.4.RELEASE'
55
junitVersion = '5.0.2'
66
}
77
repositories {
88
mavenCentral()
99
maven { url 'https://repo.spring.io/libs-snapshot' }
1010
}
1111
dependencies {
12-
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
12+
classpath group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin', version: "${springBootVersion}"
1313
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.1'
1414
}
1515
}
1616

1717
apply plugin: 'java'
1818
apply plugin: 'org.springframework.boot'
19+
apply plugin: 'io.spring.dependency-management'
1920
apply plugin: 'org.junit.platform.gradle.plugin'
21+
apply plugin: 'application'
2022

2123
jar {
22-
version = '0.8.1'
24+
version = '0.10'
2325
archiveName = 'analog.jar'
2426
manifest {
2527
attributes(
@@ -29,8 +31,8 @@ jar {
2931
)
3032
}
3133
}
32-
sourceCompatibility = 1.8
33-
targetCompatibility = 1.8
34+
sourceCompatibility = 1.9
35+
targetCompatibility = 1.9
3436

3537
repositories {
3638
// mavenLocal()
@@ -42,21 +44,20 @@ repositories {
4244
dependencies {
4345
// Backend compile deps
4446
// compile("org.springframework.boot:spring-boot-devtools:${springBootVersion}")
45-
compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")
46-
compile("org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}")
47-
compile("org.springframework.boot:spring-boot-starter-websocket:${springBootVersion}")
48-
compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
47+
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: "${springBootVersion}"
48+
compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: "${springBootVersion}"
49+
compile group: 'org.springframework.boot' , name: 'spring-boot-starter-websocket', version: "${springBootVersion}"
50+
compile group: 'net.bull.javamelody', name: 'javamelody-spring-boot-starter', version: '1.71.0'
4951

5052
compile group: 'org.springframework.integration', name: 'spring-integration-core', version: "${springIntegrationVersion}"
5153
compile group: 'org.springframework.integration', name: 'spring-integration-file', version: "${springIntegrationVersion}"
5254
compile group: 'org.springframework.integration', name: 'spring-integration-rmi', version: "${springIntegrationVersion}"
5355

56+
compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
5457
compile group: 'net.sf.jtidy', name: 'jtidy', version: 'r938'
55-
compile group: 'net.bull.javamelody', name: 'javamelody-core', version: '1.61.0'
56-
// compile group: 'com.github.albfernandez', name: 'juniversalchardet', version: '2.0.0'
5758
compile group: 'com.github.mpkorstanje', name: 'simmetrics-core', version: '4.1.1'
5859

59-
// FrontEnd deps
60+
// Frontend deps
6061
compile group: 'org.webjars', name: 'angularjs', version: '1.5.8'
6162
compile group: 'org.webjars', name: 'highlightjs', version: '9.8.0'
6263
compile group: 'org.webjars', name: 'jquery', version: '1.11.1'
@@ -68,13 +69,14 @@ dependencies {
6869
compile group: 'org.webjars.npm', name: 'balloon-css', version: '0.5.0'
6970

7071
runtime group: 'commons-logging', name: 'commons-logging', version: '1.2'
72+
runtime("org.springframework.boot:spring-boot-properties-migrator") // TODO remove after migration
7173

7274
// Test deps
73-
testCompile("org.springframework.boot:spring-boot-starter-test:${springBootVersion}")
74-
testCompile("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
75+
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: "${springBootVersion}"
76+
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: "${junitVersion}"
7577
testCompile group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
7678

77-
testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
79+
testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: "${junitVersion}"
7880
}
7981

8082
junitPlatform {

config/application-win.yaml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,26 @@ jmx:
55
host: localhost
66
port: 1099
77

8-
clusterNodes:
8+
nodes:
99
- name: angara
10-
address: angara.ftc.ru:7801
10+
host: angara.ftc.ru
11+
agentPort: 7801
12+
serverPort: 8080
1113
# myself: true
1214
- name: volga
13-
address: volga.ftc.ru:7802
15+
host: volga.ftc.ru
16+
agentPort: 7802
1417
- name: tobol
15-
address: tobol.ftc.ru:7803
18+
host: tobol.ftc.ru
19+
agentPort: 7803
20+
21+
recordLevels:
22+
- TRACE
23+
- DEBUG
24+
- INFO
25+
- WARN
26+
- ERROR
27+
- FATAL
1628

1729
choices:
1830
- group: MT
@@ -32,9 +44,12 @@ choices:
3244
- path: C:\lang\analog\log-samples\generated\core.log
3345
node: angara
3446
timestamp: yyyy-MM-dd HH:mm:ss,SSS # 2017-11-09 22:31:03,084
35-
# - node: tobol
36-
# path: C:\lang\analog\log-samples\cluster\composite.log
37-
# timestamp: dd.MM.yy HH:mm:ss,SSS
47+
- node: volga
48+
path: C:\lang\analog\log-samples\cluster\composite.log
49+
timestamp: dd.MM.yy HH:mm:ss,SSS
50+
- node: volga
51+
path: C:\lang\analog\log-samples\cluster\composite-2.log
52+
timestamp: dd.MM.yy HH:mm:ss,SSS
3853

3954
- group: Микросервисы
4055
pathBase: C:\lang\analog\log-samples\
@@ -44,8 +59,10 @@ choices:
4459
- cluster\composite.log as "$f (plain)"
4560
compositeLogs:
4661
- path: bankplus.log
62+
node: volga
4763
title: $f - $g
4864
timestamp: dd.MM.yy HH:mm:ss,SSS
4965
- path: logSample.log
66+
node: tobol
5067
title: $f - $g
5168
timestamp: dd.MM.yy HH:mm:ss,SSS
28.4 MB
Binary file not shown.

doc/application-sample.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Настройки подключения конечных пользователей:
2+
server:
3+
port: 8080 # - этот порт должен быть указан в браузере;
4+
address: mycompany.com # - имя/адрес хоста не обязательны; по умолчанию 0.0.0.0
5+
6+
# Список узлов, из которых состоит кластер АнаЛога (в том числе, если в нем всего один узел - текущий):
7+
nodes:
8+
- name: primary # читабельное имя узла (для удобства обращения)
9+
host: mycompany.com # хост узла (без порта)
10+
agentPort: 7801 # порт агента
11+
serverPort: 9090 # порт сервера (тот же, что и server.port этого узла)
12+
myself: true # признак того, что этот узел является сервером (см. выше);
13+
# такой признак должен присутствовать только у одного (серверного) узла
14+
- name: backup-node # читабельное имя второго узла
15+
host: backup.mycompany.com # хост второго узла (число узлов не ограничено)
16+
agentPort: 7801 # порт агента
17+
# serverPort: 8080 # если порт удаленного сервера равен server.port текущего, можно опустить
18+
19+
20+
# Варианты выбора логов из UI:
21+
choices:
22+
- group: MT # название группы вариантов (число групп не ограничено)
23+
pathBase: C:\lang\analog\log-samples\ # базовый путь логов в этой группе (добавляется к началу других путей)
24+
plainLogs: # список простых (одинарных) логов группы
25+
- core.log as "static $f - $g"
26+
# формат элемента списка: <fileNameOrPath>[ as "<alias>"[ (selected)]]
27+
# , где <fileNameOrPath> - полный либо относительный путь к файлу лога (в зависимости от наличия pathBase),
28+
# <alias> - отображаемое в UI имя лога в любом формате; поддерживаются подстановочные переменные:
29+
# $f - имя и расширение файла лога, $g - имя группы (пример алиаса: "Тестовый $f - $g")
30+
# (selected) - статичный признак, указывающая на то, что данный вариант лога будет выбран по умолчанию
31+
- pppinfo.log as "$f - $g" (selected)
32+
- generated\core.log as "$f - $g aka generated"
33+
compositeLogs: # список композитных (составных) логов группы
34+
- path: generated\bankplus.log # полный либо относительный путь к файлу лога (в зависимости от pathBase),
35+
timestamp: dd.MM.yy HH:mm:ss,SSS # формат временной метки
36+
node: primary # имя узла, где лежит лог (по умолчанию: узел с myself=true)
37+
title: $f - $g # имя лога (формат см. выше)
38+
# selected: true # признак выбора по умолчанию (должен быть лишь один на все варианты)
39+
includes: # список других логов, входящих в состав композита
40+
- node: backup-node # путь к включаемому логу (только абсолютный!)
41+
path: /pub/home/me/logs/backup.log # имя узла с логом (по умолчанию: узел с myself=true)
42+
timestamp: dd/MM/yy HH:mm:ss.SSS # формат временной метки
43+
scanDir: C:\lang\analog\log-samples\to-scan # полный путь к директории, все файлы которой должны автоматически
44+
# стать вариантами выбора логов (не включая поддиректории)

doc/release-notes/v0.10.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# v0.10 - 'Download current log' feature
2+
3+
This release of AnaLog is aimed to shorten the gap between browser capabilities and real users' demands - while
4+
AnaLog was deliberately designed with certain browser restrictions in mind, it is quite obvious that ability to work
5+
with whole (usually big) log files is essential for day-to-day tasks. That is why AnaLog introduces this new
6+
feature - log file
7+
downloading directly from browser.
8+
9+
There are several changes to highlight:
10+
11+
* **Download current log** button is now available for any log (not plains only) and click on it does not trigger
12+
downloading immediately anymore - instead a new 'Control Check' dialog is shown where:
13+
* Current log's node, path, size and last modified timestamp are displayed;
14+
* Download button is located along with its variants for downloading just last part of the log (50KB, 500KB, 5MB,
15+
50MB, 200MB - depending of current log size);
16+
* Dropdown select is displayed to choose a specific member of composite log (in case of latter only);
17+
* Last error (if any) occurred while fetching log details (e.g. _HTTP 404 Not Found_, _HTTP 503 Unavailable_ etc).
18+
19+
* Host and ports of cluster properties are now set separately. There are 2 kind of ports to specify:
20+
1. Agent port - a port to use by AnaLog server instance to support remote log monitoring;
21+
2. Server port - a port to use by user browser and by other servers for downloading log files from agent
22+
instances.
23+
This port is not required and by default equals to `server.port` of current AnaLog instance.
24+
25+
* `clusterNodes` param has been renamed to `nodes` as well as its `address` property has been renamed to `host` as it doesn't contain port number anymore.
26+
For example, if your configuration looks like:
27+
```yaml
28+
clusterNodes:
29+
- name: alpha
30+
address: alpha.example.com:7801
31+
```
32+
then it should be rewritten as:
33+
```yaml
34+
nodes:
35+
- name: alpha
36+
host: alpha.example.com
37+
agentPort: 7801
38+
serverPort: 8080 # may be omitted optional if equals to server.port
39+
```
40+
41+
* Added `/download` resource to AnaLog's server HTTP API:
42+
* `HEAD /download` returns content length and last modified timestamp of specified file even if it resides on
43+
remote node;
44+
* `GET /download` returns the specified file itself (as an attachment in order to facilitate streaming
45+
downloading). This also works transparently even for files on remote nodes of AnaLog.
46+
47+
The new resource is designed to be used in various ways:
48+
* By web client application (in browser) to start file downloading via dedicated button on the control panel;
49+
* By other servers to retrieve files from agents in previous scenario;
50+
* **By end users themselves** to download frequently used files (e.g. by making a browser bookmark).
51+
52+
* Every log choice is now provided with label containing its 'type' (local, remote, composite) and list of its nodes.
53+
This is a groundwork for future support of remote plain logs and composite log configuration refactoring.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip

0 commit comments

Comments
 (0)