[Error] empty log file
wang1212 opened this issue · 7 comments
Run failed, prompt message: empty log file
The specified folder does not work.
Can you run rhit with the log: RHIT_LOG=debug rhit
then show me the content of the rhit.log
file ?
nginx version: nginx/1.12.1
log content:
18:19:35.813 [INFO] cli_log: Starting rhit v1.3.2 with log level DEBUG
18:19:35.814 [DEBUG] rhit::cli: args: Args {
version: false,
color: BoolArg(
None,
),
key: Hits,
length: 1,
fields: Fields(
[
Dates,
Status,
Referers,
Paths,
],
),
changes: false,
status: None,
method: None,
ip: None,
date: None,
path: None,
all: false,
referer: None,
no_name_check: false,
file: None,
}
18:19:35.814 [DEBUG] rhit::nginx_log::log_base: finding files took 271.012µs
18:19:35.815 [DEBUG] rhit::nginx_log::log_file: reading file "/var/log/nginx/access.log.7.gz"
18:19:35.815 [WARN] rhit::nginx_log::log_file: date parse error in 10.1.84.1 - - [2021-02-23T07:38:30+08:00] "POST /api/system/satellite/saveSatellite HTTP/1.1" 200 78 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 Hutool" "-"
18:19:35.815 [WARN] rhit::nginx_log::log_file: not logging other errors in this file
18:19:35.846 [WARN] rhit::nginx_log::log_file: 44829 errors in "/var/log/nginx/access.log.7.gz"
18:19:35.846 [DEBUG] rhit::nginx_log::log_base: reading files took 31.302271ms
18:19:35.846 [DEBUG] rhit::cli: LogBase::new took 31.655501ms
OK, so rhit fails to parse the lines of your log file.
A possible cause would be a specific log format. If you've changed your nginx log format, then it's expected as the current version of rhit doesn't handle that.
If ngnix is logging with the standard format, then I'd need you log file to look into the problem (an extract of a few lines would probably be enough if you're afraid of leaking too much private data).
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/guide/nine.png HTTP/1.1" 200 1791 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/guide/business-card.png HTTP/1.1" 200 4026 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/guide/eleven.png HTTP/1.1" 200 1562 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/guide/twelve.png HTTP/1.1" 200 1732 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/guide/leopard.png HTTP/1.1" 200 5573 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/guide/party-building.png HTTP/1.1" 200 6323 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/guide/thirteen.png HTTP/1.1" 200 1731 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/authimg/background.png HTTP/1.1" 200 858905 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/guide/data-analysis.png HTTP/1.1" 200 2813 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/guide/fourteen.png HTTP/1.1" 200 1675 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/guide/fifteen.png HTTP/1.1" 200 1722 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/guide/discipline-inspection.png HTTP/1.1" 200 4060 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/guide/audit-opinion.png HTTP/1.1" 200 3911 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/guide/sixteen.png HTTP/1.1" 200 1784 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/assets/guide/trade-union-profile.png HTTP/1.1" 200 2686 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:08:37+08:00] "GET /zhly/favicon.ico HTTP/1.1" 200 67646 "http://0.0.0.0:8091/zhly/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4427.5 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:15:07+08:00] "GET /api/system/firePrevention/lisReportTheFireAlarmManually HTTP/1.1" 500 298 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:15:08+08:00] "GET /favicon.ico HTTP/1.1" 404 191 "http://0.0.0.0:8091/api/system/firePrevention/lisReportTheFireAlarmManually" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36" "-"
0.0.0.0 - - [2021-03-03T09:16:08+08:00] "GET /api/system/firePrevention/lisReportTheFireAlarmManually?dataSize=100&beginDate=2000-01-01%2000:00:00 HTTP/1.1" 500 298 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36" "-"
The error comes from your date logged in ISO 8601 format, which isn't the default.
I'll see what I can do in rhit to manage it without perf loss.
The new 1.4.0 version should fix your problem.
Please confirm, or reopen the issue if it's the same.
The error comes from your date logged in ISO 8601 format, which isn't the default.
I'll see what I can do in rhit to manage it without perf loss.
Actually I haven't changed the log configuration.
I guess it's because the default configuration of different versions of nginx is different. I found on the new version that the default date configuration seems to be $time_local
.
In any case, thank you for replying to me very quickly and solving the problem.