moved logs
This commit is contained in:
parent
e8684360ea
commit
8ec98666fc
4 changed files with 11 additions and 4 deletions
|
@ -35,6 +35,7 @@ Add the ones that differ on your system.
|
||||||
| LOG_MEASUREMENT | nginx_access_logs | InfluxDB measurement name for nginx logs. Optional, defaults to the example. |
|
| LOG_MEASUREMENT | nginx_access_logs | InfluxDB measurement name for nginx logs. Optional, defaults to the example. |
|
||||||
| SEND_NGINX_LOGS | true | Set to `false` to disable nginx logs. Optional, defaults to `true`. |
|
| SEND_NGINX_LOGS | true | Set to `false` to disable nginx logs. Optional, defaults to `true`. |
|
||||||
| GEOIP2INFLUX_LOG_LEVEL | info | Sets the log level in geoip2influx.log. Use `debug` for verbose logging Optional, defaults to info. |
|
| GEOIP2INFLUX_LOG_LEVEL | info | Sets the log level in geoip2influx.log. Use `debug` for verbose logging Optional, defaults to info. |
|
||||||
|
| GEOIP2INFLUX_LOG_PATH | /config/log/geoip2influx/geoip2influx.log | Optional. Defaults to example. |
|
||||||
| INFLUX_RETENTION | 7d | Sets the retention for the database. Optional, defaults to example.|
|
| INFLUX_RETENTION | 7d | Sets the retention for the database. Optional, defaults to example.|
|
||||||
| INFLUX_SHARD | 1d | Set the shard for the database. Optional, defaults to example. |
|
| INFLUX_SHARD | 1d | Set the shard for the database. Optional, defaults to example. |
|
||||||
| MAXMINDDB_LICENSE_KEY | xxxxxxx | Add your Maxmind licence key |
|
| MAXMINDDB_LICENSE_KEY | xxxxxxx | Add your Maxmind licence key |
|
||||||
|
|
|
@ -31,9 +31,10 @@ geo_measurement = env.get('GEO_MEASUREMENT', 'geoip2influx')
|
||||||
log_measurement = env.get('LOG_MEASUREMENT', 'nginx_access_logs')
|
log_measurement = env.get('LOG_MEASUREMENT', 'nginx_access_logs')
|
||||||
send_nginx_logs = env.get('SEND_NGINX_LOGS','true')
|
send_nginx_logs = env.get('SEND_NGINX_LOGS','true')
|
||||||
log_level = env.get('GEOIP2INFLUX_LOG_LEVEL', 'info').upper()
|
log_level = env.get('GEOIP2INFLUX_LOG_LEVEL', 'info').upper()
|
||||||
|
g2i_log_path = env.get('GEOIP2INFLUX_LOG_PATH','/config/log/geoip2influx/geoip2influx.log')
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
logging.basicConfig(level=log_level,format='%(asctime)s :: %(levelname)s :: %(message)s',datefmt='%d/%b/%Y %H:%M:%S',filename=path[0] + '/geoip2influx.log')
|
logging.basicConfig(level=log_level,format='%(asctime)s :: %(levelname)s :: %(message)s',datefmt='%d/%b/%Y %H:%M:%S',filename=g2i_log_path)
|
||||||
|
|
||||||
def regex_tester(log_path, N):
|
def regex_tester(log_path, N):
|
||||||
time_out = time() + 60
|
time_out = time() + 60
|
||||||
|
|
|
@ -13,11 +13,16 @@ GEO_MEASUREMENT=${GEO_MEASUREMENT}\\n\
|
||||||
LOG_MEASUREMENT=${LOG_MEASUREMENT}\\n\
|
LOG_MEASUREMENT=${LOG_MEASUREMENT}\\n\
|
||||||
SEND_NGINX_LOGS=${SEND_NGINX_LOGS}\\n\
|
SEND_NGINX_LOGS=${SEND_NGINX_LOGS}\\n\
|
||||||
GEOIP2INFLUX_LOG_LEVEL=${GEOIP2INFLUX_LOG_LEVEL}\\n\
|
GEOIP2INFLUX_LOG_LEVEL=${GEOIP2INFLUX_LOG_LEVEL}\\n\
|
||||||
|
GEOIP2INFLUX_LOG_PATH=${GEOIP2INFLUX_LOG_PATH}\\n\
|
||||||
MAXMINDDB_LICENSE_KEY=${MAXMINDDB_LICENSE_KEY}\\n"
|
MAXMINDDB_LICENSE_KEY=${MAXMINDDB_LICENSE_KEY}\\n"
|
||||||
|
|
||||||
mkdir -p /config/geoip2db
|
mkdir -p \
|
||||||
|
/config/geoip2db \
|
||||||
|
/config/log/geoip2influx
|
||||||
cp -f /geoip2influx/geoip2influx.py /config/geoip2db
|
cp -f /geoip2influx/geoip2influx.py /config/geoip2db
|
||||||
|
# move old log if needed
|
||||||
|
if [ -f /config/geoip2db/geoip2influx.log ]; then
|
||||||
|
mv /config/geoip2db/geoip2influx.log /config/log/geoip2influx
|
||||||
# create GeoIP2 folder symlink
|
# create GeoIP2 folder symlink
|
||||||
[[ -d /var/lib/libmaxminddb ]] && [[ ! -L /var/lib/libmaxminddb ]] && \
|
[[ -d /var/lib/libmaxminddb ]] && [[ ! -L /var/lib/libmaxminddb ]] && \
|
||||||
rm -rf /var/lib/libmaxminddb
|
rm -rf /var/lib/libmaxminddb
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/config/geoip2db/geoip2influx.log {
|
/config/log/geoip2influx/geoip2influx.log {
|
||||||
daily
|
daily
|
||||||
rotate 7
|
rotate 7
|
||||||
size 25M
|
size 25M
|
||||||
|
|
Loading…
Reference in a new issue