Skip to content

Commit

Permalink
Add some debugging info
Browse files Browse the repository at this point in the history
  • Loading branch information
CannonLock committed Sep 27, 2024
1 parent 9c1ffe3 commit 38b3d7f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ source .env
python3 import-script/import_logs.py "$LOG_PATH" --dry-run --url "$MATOMO_URL" --token-auth "$API_TOKEN"

# Print out the command that was just ran
echo "python3 import-script/import_logs.py \"$LOG_PATH\" --dry-run --url \"$MATOMO_URL\" --token-auth \"$API_TOKEN\""
echo "python3 import-script/import_logs.py \"$LOG_PATH\" --url \"$MATOMO_URL\" --token-auth \"$API_TOKEN\""
```

## The Docker Image

```bash
docker build -t matomo-log-scraper:latest .
docker run --env-file .env --rm -it matomo-log-scraper:latest
docker run --env-file .env --rm -it -v $PWD/test-logs:/app/test-logs matomo-log-scraper:latest
```
3 changes: 2 additions & 1 deletion crontab
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Run logrotate.sh daily at midnight
0 0 * * * /app/logrotate.sh >> /var/log/cron.log 2>&1
* * * * * /app/logrotate.sh >> /var/log/cron.log 2>&1
* * * * * echo "Hello World! I am working!" >> /var/log/cron.log 2>&1
6 changes: 4 additions & 2 deletions logrotate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Create a temporary logrotate configuration file
cat <<EOF > /tmp/logrotate.conf
$LOG_PATH {
"$LOG_PATH" {
daily
rotate 31
compress
Expand All @@ -13,8 +13,10 @@ $LOG_PATH {
}
EOF

cat /tmp/logrotate.conf

# Run logrotate with the temporary configuration file
/usr/sbin/logrotate /tmp/logrotate.conf
/usr/sbin/logrotate --force -d /tmp/logrotate.conf

# Clean up the temporary configuration file
rm /tmp/logrotate.conf

0 comments on commit 38b3d7f

Please sign in to comment.