mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
- Add script to hackily check for progress on a long import.
This commit is contained in:
parent
8462bd05fa
commit
97d71ed130
1 changed files with 21 additions and 0 deletions
21
misc/rate.sh
Executable file
21
misc/rate.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/zsh
|
||||
|
||||
if [ "$#" -ne 1 ] ; then
|
||||
echo "Usage; $0 logfile"
|
||||
exit 1
|
||||
fi
|
||||
logfile="$1"
|
||||
|
||||
pid=$(ps -u $USER -f | awk '/bin.logstash -[f]/ {print $2}')
|
||||
fileno=$(lsof -nPp $pid | grep -F "$logfile" | awk '{ print int($4) }')
|
||||
pos=$(awk '/pos:/ {print $2}' /proc/$pid/fdinfo/$fileno)
|
||||
starttime=$(awk '{print $22}' /proc/$pid/stat)
|
||||
curtime=$(awk '{print $1}' /proc/uptime)
|
||||
lines=$(dd if="$logfile" bs=$pos count=1 | wc -l)
|
||||
|
||||
duration=$(($curtime - ($starttime / 100.)))
|
||||
rate=$(( $lines / (0.0 + $duration) ))
|
||||
|
||||
echo "Duration: $duration"
|
||||
echo "Rate: $rate"
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue