Compare commits
3 Commits
3fd8a66257
...
2b9580382f
Author | SHA1 | Date | |
---|---|---|---|
|
2b9580382f | ||
|
87d3215c70 | ||
|
662879e8a0 |
1
etc/logwatch/conf/logfiles/cfddns.conf
Normal file
1
etc/logwatch/conf/logfiles/cfddns.conf
Normal file
@ -0,0 +1 @@
|
|||||||
|
LogFile = /path/to/your/cfddns.log
|
2
etc/logwatch/conf/services/cfddns.conf
Normal file
2
etc/logwatch/conf/services/cfddns.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
LogFile = cfddns
|
||||||
|
Title = "CloudFlare DDNS update"
|
44
etc/logwatch/scripts/services/cfddns
Normal file
44
etc/logwatch/scripts/services/cfddns
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
### Script to parse cfddns.sh log file and display important information
|
||||||
|
###
|
||||||
|
### Levels:
|
||||||
|
### Levels are defined in this script as 0-4, 5 & 5+
|
||||||
|
### Levels 0-4 (same): Basic information reporting
|
||||||
|
### Reports only critical information such as errors, update successes and
|
||||||
|
### failures.
|
||||||
|
### Level 5: Recommended information reporting level
|
||||||
|
### Adds informational messages such as the hostnames being updated and the
|
||||||
|
### IP address being used for that update.
|
||||||
|
### Level 5+ (same): Verbose logging
|
||||||
|
### This will just reprint the entire log. This should only be used when
|
||||||
|
### checking the actual logfile is not possible or you prefer looking at it
|
||||||
|
### via Logwatch for some reason. Note: ANSI colouring is removed by this
|
||||||
|
### script to faciliate Logwatch conversion to HTML. Therefore, viewing
|
||||||
|
### that actual log file is highly recommended instead of via this level of
|
||||||
|
### reporting in Logwatch.
|
||||||
|
|
||||||
|
|
||||||
|
### Create temporary file for assembling log entries
|
||||||
|
cfddnsTmpFile=$(mktemp -p "${LOGWATCH_TEMP_DIR}")
|
||||||
|
|
||||||
|
### Assemble the temp file according to desired Logwatch detail level
|
||||||
|
if [ "$LOGWATCH_DETAIL_LEVEL" -lt 5 ]; then
|
||||||
|
# get error, success and status messages
|
||||||
|
{ grep '\-- \[ERROR\]' ; grep '\-- \[SUCCESS\]' ; \
|
||||||
|
grep '\-- \[STATUS\]' ; } >> "$cfddnsTmpFile"
|
||||||
|
elif [ "$LOGWATCH_DETAIL_LEVEL" -eq 5 ]; then
|
||||||
|
# get error, success, status and info messages
|
||||||
|
{ grep '\-- \[ERROR\]' ; grep '\-- \[SUCCESS\]' ; \
|
||||||
|
grep '\-- \[STATUS\]' ; grep '\-- \[INFO\]' ; } >> "$cfddnsTmpFile"
|
||||||
|
elif [ "$LOGWATCH_DETAIL_LEVEL" -gt 5 ]; then
|
||||||
|
cat
|
||||||
|
fi
|
||||||
|
|
||||||
|
### Strip ANSI escape codes and sort entries according to timestamps
|
||||||
|
sed -e 's,\x1B\[[0-9;]*[a-zA-Z],,g' "${cfddnsTmpFile}" | sort -n
|
||||||
|
|
||||||
|
### Clean-up and exit
|
||||||
|
rm -f "${cfddnsTmpFile}" > /dev/null 2>&1
|
||||||
|
exit 0
|
Loading…
Reference in New Issue
Block a user