Skip to content

Commit

Permalink
Merge pull request #14 from catscarlet/dev
Browse files Browse the repository at this point in the history
Prepare v0.5.0
  • Loading branch information
catscarlet committed Apr 4, 2021
2 parents 192c271 + 0f694ba commit ce96387
Show file tree
Hide file tree
Showing 8 changed files with 1,185 additions and 1,129 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ This is a Client-Only web log analyzing tool.

This tool is dedicated to analyze apache.log in local browser. It won't send log to server. All works will be done in local browser.

This tool reads log line by using regex and support default format of apache log `LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""`

like:

```
117.14.147.49 - - [21/Feb/2021:00:40:26 +0800] "GET / HTTP/1.1" 200 906 "https://www.catscarlet.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0"
```

For now it doesn't support customized format. If you want to analyze your customized log, you need to change your log file to default format, or modify core.js by yourself.

This project is still WIP.

## Screenshot
Expand Down
12 changes: 11 additions & 1 deletion README_zh-cmn-Hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@

此款工具致力于在本地直接加载 apache.log 并进行分析。工具并不会向服务端发送任何数据,日志分析全部在本地浏览器中进行。

目前功能仍在开发中。很多功能都没有实现。
对日志的条目默认是以正则实现的,可以识别 apache 的默认日志格式 `LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""`

比如:

```
117.14.147.49 - - [21/Feb/2021:00:40:26 +0800] "GET / HTTP/1.1" 200 906 "https://www.catscarlet.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0"
```

目前不支持在界面定制默认日志格式。如果您需要使用自定义格式日志,请转换成默认格式,或修改 core.js 中的正则。

目前项目仍在开发中。

# 截图

Expand Down
2 changes: 1 addition & 1 deletion vue-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
"build": "vue-cli-service build",
"serve": "vue-cli-service serve"
},
"version": "0.4.3"
"version": "0.5.0"
}
28 changes: 8 additions & 20 deletions vue-app/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@
</div>

<div v-else-if="analyzed_status == 1">
<el-alert type="warning" show-icon :closable="false"> Ready to Analyze: {{ fileinfo.name }} </el-alert>
<el-alert type="warning" show-icon :closable="false"> Ready to Analyze: <strong>{{ fileinfo.name }}</strong> </el-alert>
</div>

<div v-else-if="analyzed_status == 2">
<el-alert title="Analyzing" type="warning" show-icon :closable="false"></el-alert>
</div>

<div v-else-if="analyzed_status == 3">
<el-alert title="Successfully Analyzed" type="success" show-icon :closable="false"></el-alert>
<el-alert type="success" show-icon :closable="false"> Successfully Analyzed: <strong>{{ fileinfo.name }}</strong></el-alert>
</div>

<div v-else-if="analyzed_status == 4">
<el-alert title="Storaged Analyzed Data Loaded" type="success" show-icon :closable="false"></el-alert>
<el-alert type="success" show-icon :closable="false"> Storaged Analyzed Data Loaded: <strong>{{ fileinfo.name }}</strong> </el-alert>
</div>

<div v-else-if="analyzed_status == -1">
Expand Down Expand Up @@ -176,7 +176,6 @@ export default {
},
beforeMount() {
this.init();
//this.getUserInfoTest();
},
methods: {
init() {
Expand All @@ -197,15 +196,12 @@ export default {
let reader = new FileReader();
reader.onload = e => {
//console.log(this);
//this.$emit('load', e.target.result);
this.reader_result = reader.result;
let filecontent = reader.result.split('\n');
let fileinfo = {
name: file.name,
size: file.size,
};
console.log(fileinfo);
this.fileinfo = fileinfo;
};
Expand All @@ -224,15 +220,6 @@ export default {
this.analyzed_status = 2;
/*
let that = this;
this.$nextTick().then(function() {
that.startAnalyze();
});
*/
//setTimeout(this.startAnalyze(), 1);
this.startAnalyze();
},
startAnalyze() {
Expand All @@ -251,6 +238,9 @@ export default {
}
console.log('going to save analyzed_data');
analyzed_data.fileinfo = this.fileinfo;
console.log(analyzed_data);
if (this.saveToLocalStorage(analyzed_data) === true) {
Expand All @@ -272,16 +262,14 @@ export default {
this.analyzed_status = 0;
} else {
this.analyzed_status = 4;
let analyzed_data = GlobalGetAnalyzedData();
this.fileinfo = analyzed_data.fileinfo;
};
},
reset() {
window.localStorage.clear();
window.location.reload();
},
debug1() {
let analyzed_data = JSON.parse(window.localStorage.getItem('AnalyzedDataStorage'));
console.log(analyzed_data);
},
cleanAnalyzedData() {
if (this.analyzed_status >= 3) {
window.localStorage.removeItem('AnalyzedDataStorage');
Expand Down
3 changes: 2 additions & 1 deletion vue-app/src/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const GlobalSaveAnalyzedData = (analyzed_data) => {

export const GlobalGetAnalyzedData = () => {
let analyzed_data_storage = window.localStorage.getItem('AnalyzedDataStorage');
let analyzed_data = JSON.parse(analyzed_data_storage);

return JSON.parse(analyzed_data_storage);
return analyzed_data;
};
2 changes: 1 addition & 1 deletion vue-app/src/components/TopReferrerUrlTimes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default {
for (let item of this.analyzed_data.top_referrer_page_times_array) {
if (this.isValidURL(item.id)) {
tmp.push({
id: `${item.id} <a href="${item.id}" target="_blank"><i class="el-icon-link"></i></a>`,
id: `${item.id} <a href="${item.id}" target="_blank" rel="noopener noreferrer"><i class="el-icon-link"></i></a>`,
value: item.value,
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion vue-app/src/components/TopReferrerUrlTraffic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default {
for (let item of this.analyzed_data.top_referrer_page_traffic_array) {
if (this.isValidURL(item.id)) {
tmp.push({
id: `${item.id} <a href="${item.id}" target="_blank"><i class="el-icon-link"></i></a>`,
id: `${item.id} <a href="${item.id}" target="_blank" rel="noopener noreferrer"><i class="el-icon-link"></i></a>`,
value: item.value,
});
} else {
Expand Down

0 comments on commit ce96387

Please sign in to comment.