Implement time stamp and improve reporter syntax.
The directory access time used so far is modified on every ansible run and independent of the ansible module/playbook.
This commit is contained in:
parent
5ed4c2a135
commit
aa8bc09ce6
4 changed files with 25 additions and 13 deletions
|
@ -11,11 +11,11 @@ logdir="/tmp/collector"
|
|||
mkdir -vp "$logdir"
|
||||
|
||||
nc -k -l -u -p "$port" | while read line ; do
|
||||
sndr="${line%%:*}"
|
||||
msg="${line#*: }"
|
||||
sndr="${line%% *}"
|
||||
msg="${line#* }"
|
||||
if [[ "$sndr" =~ [a-z0-9]+ ]] ; then
|
||||
if [[ "$msg" =~ ^-------\ .+\ -------$ ]] ; then
|
||||
echo "$(date --rfc-3339=seconds) → Message from '$sndr' received."
|
||||
echo "$(date --rfc-3339=seconds) → Report from '$sndr' received."
|
||||
echo "$msg" > "$logdir/$sndr"
|
||||
else
|
||||
echo "$msg" >> "$logdir/$sndr"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue