Skip to content

Commit d7df4bf

Browse files
v1.1.15
- updated GoAccess to v1.7.2 - updated MaxMind databases to 4/30/2023 - added fallback and dead log files to the redirection instance - syncing main with dev branch - performance changes - updated readme file with more file types for NPM+R
1 parent 376e4d7 commit d7df4bf

File tree

11 files changed

+62
-71
lines changed

11 files changed

+62
-71
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN apk add --no-cache \
99

1010
# download goaccess
1111
WORKDIR /goaccess-temp
12-
COPY /assests/goaccess/goaccess-1.7.1.tar.gz goaccess.tar.gz
12+
COPY /assests/goaccess/goaccess-1.7.2.tar.gz goaccess.tar.gz
1313

1414
# set up goacess-debug
1515
WORKDIR /goaccess-debug
@@ -23,7 +23,7 @@ RUN make install
2323
WORKDIR /goaccess
2424
RUN cp /goaccess-temp/goaccess.tar.gz .
2525
RUN tar --strip-components=1 -xzvf goaccess.tar.gz
26-
RUN sed -i "s/GWSocket<\/a>/GWSocket<\/a> ( <a href='https:\/\/tiny.one\/xgoan'>GOAN<\/a> <span>v1.1.14<\/span> )/" /goaccess/resources/tpls.html
26+
RUN sed -i "s/GWSocket<\/a>/GWSocket<\/a> ( <a href='https:\/\/tiny.one\/xgoan'>GOAN<\/a> <span>v1.1.15<\/span> )/" /goaccess/resources/tpls.html
2727
RUN sed -i "s/bottom: 190px/bottom: 260px/" /goaccess/resources/css/app.css
2828
RUN ./configure --enable-utf8 --enable-geoip=mmdb --with-getline
2929
RUN make

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ Still in development... You might need to wait a bit if you have a large amount
1414
![Alt text](https://i.ibb.co/fNj9Dcy/goaccess1.jpg "GoAccess Dashboard")
1515

1616
**Dependencies:**
17-
- GoAccess version: 1.7.1
18-
- GeoLite2-City.mmdb (2023-03-21)
19-
- GeoLite2-Country.mmdb (2023-03-21)
20-
- GeoLite2-ASN.mmdb (2023-03-21)
17+
- GoAccess version: 1.7.2
18+
- GeoLite2-City.mmdb (2023-04-30)
19+
- GeoLite2-Country.mmdb (2023-04-30)
20+
- GeoLite2-ASN.mmdb (2023-04-30)
2121

2222
---
2323

@@ -124,9 +124,13 @@ services:
124124
- NPM+R
125125
- a second instance of GOACCESS is created
126126
- append "/redirection" to the url to access the instance, for example http://localhost:7880/redirection/
127-
- the following file(s) are read and parsed.
128-
- redirection\*host-*.log*.gz
129-
- redirection\*host-*.log
127+
- the following file(s) are read and parsed:
128+
- redirection\*host-\*.log*.gz
129+
- redirection\*host-\*.log
130+
- fallback_access.log\*.gz
131+
- fallback_access.log
132+
- dead-host\*.log*.gz
133+
- dead-host*.log
130134
- NPM+ALL
131135
- a second and third instance of GOACCESS are created
132136
- append "/redirection" to the url to access the instance, for example http://localhost:7880/redirection/
-662 KB
Binary file not shown.
663 KB
Binary file not shown.

assests/maxmind/GeoLite2-ASN.mmdb

31.9 KB
Binary file not shown.

assests/maxmind/GeoLite2-City.mmdb

97.2 KB
Binary file not shown.
18.6 KB
Binary file not shown.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
11
#!/bin/bash
22

3+
function checkFile(){
4+
if [ -z "$1" ]; then
5+
return 1
6+
else
7+
if [ -e "$file" ] && [ -r "$file" ]; then
8+
echo -e "\tFile $file exists and is readable"
9+
return 0
10+
elif [ -e "$file_path" ]; then
11+
echo -e "\tFile $file exists but is not readable"
12+
return 1
13+
else
14+
echo -e "\tFile $file does not exist"
15+
return 1
16+
fi
17+
fi
18+
}

resources/scripts/logs/npm.sh

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function npm(){
6060

6161
echo -e "\n\tAdding proxy logs..."
6262
IFS=$'\n'
63-
for file in $(find "${goan_log_path}" -name 'proxy*host-*.log' ! -name "*_error.log");
63+
for file in $(find "${goan_log_path}" -name 'proxy*host-*_access.log' ! -name "*_error.log");
6464
do
6565
pressOn=0
6666

@@ -79,14 +79,10 @@ function npm(){
7979
fi
8080

8181
if [[ $pressOn == 1 ]]; then
82-
if [ -e "$file" ] && [ -r "$file" ]; then
82+
checkFile "$file"
83+
if [ $? -eq 0 ]; then
8384
echo "log-file ${file}" >> ${goan_config}
84-
goan_log_count=$((goan_log_count+1))
85-
echo -e "\tFile $file exists and is readable"
86-
elif [ -e "$file_path" ]; then
87-
echo -e "\tFile $file exists but is not readable"
88-
else
89-
echo -e "\tFile $file does not exist"
85+
((goan_log_count++))
9086
fi
9187
fi
9288
done
@@ -127,14 +123,10 @@ function npm(){
127123
fi
128124

129125
if [[ $pressOn == 1 ]]; then
130-
if [ -e "$file" ] && [ -r "$file" ]; then
131-
echo -e "\tFile $file exists and is readable"
132-
((goan_archive_detail_log_count++))
126+
checkFile "$file"
127+
if [ $? -eq 0 ]; then
133128
zcat -f ${file} >> ${archive_log}
134-
elif [ -e "$file_path" ]; then
135-
echo -e "\tFile $file exists but is not readable"
136-
else
137-
echo -e "\tFile $file does not exist"
129+
((goan_archive_detail_log_count++))
138130
fi
139131
fi
140132
done

resources/scripts/logs/npm_redirection.sh

Lines changed: 25 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function npm_redirect_goaccess_config(){
3030
echo -e "\n\n\n" >> ${goan_config}
3131
echo "######################################" >> ${goan_config}
3232
echo "# ${goan_version}" >> ${goan_config}
33-
echo "# GOAN_NPM_REDIRECTION_CONFIG" >> ${goan_config}
33+
echo "# GOAN_NPM_REDIRECTION_FALLBACK_DEAD_CONFIG" >> ${goan_config}
3434
echo "######################################" >> ${goan_config}
3535
echo "time-format %T" >> ${goan_config}
3636
echo "date-format %d/%b/%Y" >> ${goan_config}
@@ -44,44 +44,33 @@ function npm_redirect(){
4444
npm_redirect_init
4545
npm_redirect_goaccess_config
4646

47-
echo -e "\nLOADING REDIRECTION LOGS"
48-
echo "-------------------------------"
47+
echo -e "\nLOADING REDIRECTION/FALLBACK/DEAD LOGS"
48+
echo "---------------------------------------"
4949

5050
echo $'\n' >> ${goan_config}
51-
echo "#GOAN_REDIRECTION_LOG_FILES" >> ${goan_config}
51+
echo "#GOAN_REDIRECTION_FALLBACK_DEAD_LOG_FILES" >> ${goan_config}
5252
echo "log-file ${archive_log}" >> ${goan_config}
5353
echo "log-file ${active_log}" >> ${goan_config}
5454

5555
goan_log_count=0
5656
goan_archive_log_count=0
5757

58-
echo -e "\n#GOAN_NPM_REDIRECT_FILES" >> ${goan_config}
58+
echo -e "\n#GOAN_NPM_REDIRECT_FALLBACK_DEAD_FILES" >> ${goan_config}
5959
if [[ -d "${goan_log_path}" ]]; then
6060

61-
echo -e "\n\tAdding redirection logs..."
61+
echo -e "\n\tAdding redirection/fallback/dead logs..."
6262
IFS=$'\n'
63-
for file in $(find "${goan_log_path}" -name 'redirection*host-*.log' ! -name "*_error.log");
63+
for file in $(find "${goan_log_path}" \( -name 'redirection*host-*.log' -o -name 'fallback_access.log' -o -name 'dead-host*.log' \) ! -name "*_error.log*");
6464
do
65-
if [ -f $file ]
66-
then
67-
if [ -r $file ] && R="Read = yes" || R="Read = No"
68-
then
69-
echo "log-file ${file}" >> ${goan_config}
70-
goan_log_count=$((goan_log_count+1))
71-
echo -ne ' \t '
72-
echo "Filename: $file | $R"
73-
else
74-
echo -ne ' \t '
75-
echo "Filename: $file | $R"
76-
fi
77-
else
78-
echo -ne ' \t '
79-
echo "Filename: $file | Not a file"
65+
checkFile "$file"
66+
if [ $? -eq 0 ]; then
67+
echo "log-file ${file}" >> ${goan_config}
68+
((goan_log_count++))
8069
fi
8170
done
8271
unset IFS
8372

84-
echo -e "\tFound (${goan_log_count}) redirection logs..."
73+
echo -e "\tFound (${goan_log_count}) redirection/fallback/dead logs..."
8574

8675
echo -e "\n\tSKIP ARCHIVED LOGS"
8776
echo -e "\t-------------------------------"
@@ -90,36 +79,28 @@ function npm_redirect(){
9079
echo -e "\tTRUE"
9180
else
9281
echo -e "\tFALSE"
93-
goan_archive_log_count=`ls -1 ${goan_log_path}/redirection*host-*.log*.gz 2> /dev/null | wc -l`
94-
82+
goan_archive_log_count=$(find "${goan_log_path}" -type f \( -name 'redirection*host-*.log*.gz' -o -name 'fallback_access.log*.gz' -o -name 'dead-host*.log*.gz' \) ! -name "*_error.log*" | wc -l)
83+
goan_archive_detail_log_count=0
84+
9585
if [ $goan_archive_log_count != 0 ]
9686
then
97-
echo -e "\n\tAdding redirection archive logs..."
87+
echo -e "\n\tAdding redirection/fallback/dead archive logs..."
9888

9989
IFS=$'\n'
100-
for file in $(find "${goan_log_path}" -name 'redirection*host-*.log*.gz' ! -name "*_error.log");
90+
for file in $(find "${goan_log_path}" \( -name 'redirection*host-*.log*.gz' -o -name 'fallback_access.log*.gz' -o -name 'dead-host*.log*.gz' \) ! -name "*_error.log*");
10191
do
102-
if [ -f $file ]
103-
then
104-
if [ -r $file ] && R="Read = yes" || R="Read = No"
105-
then
106-
echo -ne ' \t '
107-
echo "Filename: $file | $R"
108-
else
109-
echo -ne ' \t '
110-
echo "Filename: $file | $R"
111-
fi
112-
else
113-
echo -ne ' \t '
114-
echo "Filename: $file | Not a file"
92+
checkFile "$file"
93+
if [ $? -eq 0 ]; then
94+
zcat -f ${file} >> ${archive_log}
95+
((goan_archive_detail_log_count++))
11596
fi
11697
done
11798
unset IFS
11899

119-
echo -e "\tAdded (${goan_archive_log_count}) redirection archived logs from ${goan_log_path}..."
120-
zcat -f ${goan_log_path}/redirection*host-*.log*.gz > ${archive_log}
100+
echo -e "\n\tAdded (${goan_archive_detail_log_count}) redirection/fallback/dead archived logs from ${goan_log_path}..."
101+
121102
else
122-
echo -e "\tNo redirection archived logs found at ${goan_log_path}..."
103+
echo -e "\tNo redirection/fallback archived logs found at ${goan_log_path}..."
123104
fi
124105
fi
125106

@@ -141,7 +122,7 @@ function npm_redirect(){
141122
echo "Logs processing: $(($goan_log_count + $goan_archive_log_count)) (might take some time depending on the number of files to parse)" >> ${nginx_html}
142123
echo "<br/></p></body></html>" >> ${nginx_html}
143124

144-
echo -e "\nRUN NPM REDIRECT GOACCESS"
125+
echo -e "\nRUN NPM REDIRECT/FALLBACK GOACCESS"
145126
if [[ "${DEBUG}" == "True" ]]; then
146127
/goaccess-debug/goaccess --debug-file=${goaccess_debug_file} --invalid-requests=${goaccess_invalid_file} --no-global-config --config-file=${goan_config} &
147128
else

0 commit comments

Comments
 (0)