mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-11-10 22:50:04 +01:00
31 lines
980 B
Bash
31 lines
980 B
Bash
#!/bin/bash
|
|
#
|
|
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
|
|
# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
|
|
# https://securityonion.net/license; you may not use this file except in compliance with the
|
|
# Elastic License 2.0.
|
|
|
|
|
|
|
|
# if this script isn't already running
|
|
if [[ ! "`pidof -x $(basename $0) -o %PPID`" ]]; then
|
|
|
|
CONTAINERSLOG=/var/log/somon/containers.log
|
|
# the collector rewrites this every minute; report nothing rather than repeating a stale
|
|
# file as if it were current, in case a run was skipped or the collector is wedged.
|
|
# Kept under two collector cycles so a 60s telegraf interval can't emit the same snapshot twice.
|
|
MAXAGE=90
|
|
|
|
if [ -r "$CONTAINERSLOG" ]; then
|
|
AGE=$(( $(date +%s) - $(stat -c %Y "$CONTAINERSLOG") ))
|
|
if [ "$AGE" -le "$MAXAGE" ]; then
|
|
cat $CONTAINERSLOG
|
|
fi
|
|
fi
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
exit 0
|