Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.1.25 #176

Merged
merged 2 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN make install
WORKDIR /goaccess
RUN cp /goaccess-temp/goaccess.tar.gz .
RUN tar --strip-components=1 -xzvf goaccess.tar.gz
RUN sed -i "s/GWSocket<\/a>/GWSocket<\/a> ( <a href='https:\/\/tiny.one\/xgoan'>GOAN<\/a> <span>v1.1.24<\/span> )/" /goaccess/resources/tpls.html
RUN sed -i "s/GWSocket<\/a>/GWSocket<\/a> ( <a href='https:\/\/tiny.one\/xgoan'>GOAN<\/a> <span>v1.1.25<\/span> )/" /goaccess/resources/tpls.html
RUN sed -i "s/bottom: 190px/bottom: 260px/" /goaccess/resources/css/app.css
RUN ./configure --enable-utf8 --enable-geoip=mmdb --with-getline
RUN make
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ services:
- SKIP_ARCHIVED_LOGS
- by default the following file(s) are read and parsed.
- *.log
- NGINX_ACCESS
- the following file(s) are read and parsed.
- access.log


# **LOG FORMATS**
Expand Down Expand Up @@ -207,6 +210,13 @@ date-format %d/%b/%Y
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u" %Lm"
```

### NGINX ACCESS LOG FORMAT
```
time-format %T
date-format %d/%b/%Y
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"
```


# **Possible/Known Issues**
- A lot of CPU Usage and 10000 request every second in webUI
Expand Down
121 changes: 121 additions & 0 deletions resources/scripts/logs/nginx_access.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#!/bin/bash
function nginx_access_init(){
goan_config="/goaccess-config/goaccess.conf"
nginx_html="/var/www/html/index.html"
html_config="/var/www/html/goaccess_conf.html"
archive_log="/goaccess-config/archive.log"
active_log="/goaccess-config/active.log"

if [[ -f ${goan_config} ]]; then
rm ${goan_config}
else
mkdir -p "/goaccess-config/"
cp /goaccess-config/goaccess.conf.bak ${goan_config}
fi
if [[ -f ${nginx_html} ]]; then
rm ${nginx_html}
else
mkdir -p "/var/www/html/"
touch ${nginx_html}
fi
if [[ -f ${html_config} ]]; then
rm ${html_config}
fi

echo -n "" > ${archive_log}
echo -n "" > ${active_log}
}

function nginx_access_goaccess_config(){
echo -e "\n\n\n" >> ${goan_config}
echo "######################################" >> ${goan_config}
echo "# ${goan_version}" >> ${goan_config}
echo "# GOAN_PROXY_CONFIG" >> ${goan_config}
echo "######################################" >> ${goan_config}
echo "time-format %T" >> ${goan_config}
echo "date-format %d/%b/%Y" >> ${goan_config}
echo "log-format %h %^[%d:%t %^] \"%r\" %s %b \"%R\" \"%u\"" >> ${goan_config}
echo "port 7890" >> ${goan_config}
echo "real-time-html true" >> ${goan_config}
echo "output ${nginx_html}" >> ${goan_config}
if [[ "${ENABLE_BROWSERS_LIST}" == "True" || ${ENABLE_BROWSERS_LIST} == true ]]; then
echo -e "\n\tENABLING NGINX ACCESS INSTANCE GOACCESS BROWSERS LIST"
browsers_file="/goaccess-config/browsers.list"
echo "browsers-file ${browsers_file}" >> ${goan_config}
fi
}

function nginx_access(){
nginx_access_init
nginx_access_goaccess_config

echo -e "\nLOADING NGINX ACCESS LOGS"
echo "-------------------------------"

echo $'\n' >> ${goan_config}
echo "#GOAN_DEFAULT_LOG_FILES" >> ${goan_config}
echo "log-file ${archive_log}" >> ${goan_config}
echo "log-file ${active_log}" >> ${goan_config}

goan_log_count=0
goan_archive_log_count=0

echo -e "\n#GOAN_NGINX ACCESS_LOG_FILES" >> ${goan_config}
if [[ -d "${goan_log_path}" ]]; then

echo -e "\n\tAdding proxy logs..."
IFS=$'\n'

for file in $(find "${goan_log_path}" -name 'access.log' ! -name "error.log");
do
if [ -f $file ]
then
if [ -r $file ] && R="Read = yes" || R="Read = No"
then
echo "log-file ${file}" >> ${goan_config}
goan_log_count=$((goan_log_count+1))
echo -ne ' \t '
echo "Filename: $file | $R"
else
echo -ne ' \t '
echo "Filename: $file | $R"
fi
else
echo -ne ' \t '
echo "Filename: $file | Not a file"
fi
done
unset IFS
else
echo "Problem loading directory (check directory or permissions)... ${goan_log_path}"
fi

if [ $goan_log_count != 0 ]
then
echo "Found (${goan_log_count}) proxy logs..."
else
echo "No access.log found. Creating an empty log file..."
touch "${goan_log_path}/access.log"
fi

#additonal config settings
exclude_ips ${goan_config}
debug ${goan_config} ${html_config}
set_geoip_database ${goan_config}

echo -e "\nSKIP ARCHIVED LOGS"
echo "-------------------------------"
echo "FEATURE NOT AVAILABLE FOR NGINX ACCESS"

#write out loading page
echo "<!doctype html><html><head>" > ${nginx_html}
echo "<title>GOAN - ${goan_version}</title>" >> ${nginx_html}
echo "<meta http-equiv=\"refresh\" content=\"1\" >" >> ${nginx_html}
echo "<style>body {font-family: Arial, sans-serif;}</style>" >> ${nginx_html}
echo "</head><body><p><b>${goan_version}</b><br/><br/>loading... <br/><br/>" >> ${nginx_html}
echo "Logs processing: $(($goan_log_count)) (might take some time depending on the number of files to parse)" >> ${nginx_html}
echo "<br/></p></body></html>" >> ${nginx_html}

echo -e "\nRUN NGINX ACCESS GOACCESS"
runGoAccess
}
2 changes: 1 addition & 1 deletion resources/scripts/logs/npm_error.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function npm_error_goaccess_config(){
echo "######################################" >> ${goan_config}
echo "time-format %T" >> ${goan_config}
echo "date-format %Y/%m/%d" >> ${goan_config}
echo "log_format %d %t %^: %v, %^: %h, %^ %v %^"%r" %^" >> ${goan_config}
echo "log_format %d %t %^: %v, %^: %h, %^ %v %^\"%r\" %^" >> ${goan_config}
echo "port 7892" >> ${goan_config}
echo "real-time-html true" >> ${goan_config}
echo "output ${nginx_html}" >> ${goan_config}
Expand Down
5 changes: 4 additions & 1 deletion resources/scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ source $(dirname "$0")/logs/npm_error.sh
source $(dirname "$0")/logs/traefik.sh
source $(dirname "$0")/logs/custom.sh
source $(dirname "$0")/logs/ncsa_combined.sh
source $(dirname "$0")/logs/nginx_access.sh

goan_version="GOAN v1.1.24"
goan_version="GOAN v1.1.25"
goan_log_path="/opt/log"

goaccess_ping_interval=15
Expand Down Expand Up @@ -80,6 +81,8 @@ elif [[ "${LOG_TYPE}" == "NCSA_COMBINED" ]]; then
ncsa_combined
elif [[ "${LOG_TYPE}" == "CUSTOM" ]]; then
custom
elif [[ "${LOG_TYPE}" == "NGINX_ACCESS" ]]; then
nginx_access
fi
# END PROXY LOGS

Expand Down
Loading