Created
April 2, 2015 19:54
-
-
Save hartfordfive/34792fb6e8dd75478539 to your computer and use it in GitHub Desktop.
Get list of files open by logstash-forwarder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
OUTPUT=`lsof -X -c logstash- | egrep -v '\.logstash-forwarder' | egrep -E '[0-9]+r\s+REG' | awk '{print $9}'` | |
case "$1" in | |
'json') | |
FILES=`printf ",\"%s\"" \${OUTPUT[@]}` | |
echo "{\"open_files\": [${FILES:1:${#FILES}-1}]}" | |
;; | |
*) | |
for F in "$OUTPUT" | |
do | |
echo "$F" | |
done | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment