# Zcashd Stats and/or Logfile

**URL:** <https://forum.zcashcommunity.com/t/zcashd-stats-and-or-logfile/1124>\
**Category:** zcashd client\
**Created:** [August 5, 2016, 8:01am UTC](https://forum.zcashcommunity.com/t/zcashd-stats-and-or-logfile/1124 "2016-08-05T08:01:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/vincent/32/278_2.png) [@vincent](https://forum.zcashcommunity.com/u/vincent)\
**Post date:** [August 5, 2016, 8:01am UTC](https://forum.zcashcommunity.com/t/zcashd-stats-and-or-logfile/1124/1 "2016-08-05T08:01:28Z")

</div>

Is there a way to get detailed stats what zcashd has done in the last day/week/month? E. g. number of coins mined etc.

Is there a logfile and where can I find it?

---

<div class="post-metadata">

**Author:** ![Voluntary](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/voluntary/32/4343_2.png) [@Voluntary](https://forum.zcashcommunity.com/u/Voluntary)\
**Post date:** [August 5, 2016, 11:57am UTC](https://forum.zcashcommunity.com/t/zcashd-stats-and-or-logfile/1124/2 "2016-08-05T11:57:28Z")

</div>

> zcash-cli getinfo  
> zcash-cli getwalletinfo  
> zcash-cli getmininginfo

One (or more) of those will give you the current number of blocks, from which you can multiply by the block reward. This doesn’t account for the mining slow start.

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/vincent/32/278_2.png) [@vincent](https://forum.zcashcommunity.com/u/vincent)\
**Post date:** [August 5, 2016, 12:36pm UTC](https://forum.zcashcommunity.com/t/zcashd-stats-and-or-logfile/1124/3 "2016-08-05T12:36:07Z")

</div>

Thanks, didn’t know about the last two. A log with timestamps would still be nice. Do you know if there’s something like “hooks” so that I an make zcashd inform other processes whenever a specific event happens?

---

<div class="post-metadata">

**Author:** ![zawy](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/zawy/32/11892_2.png) [@zawy](https://forum.zcashcommunity.com/u/zawy)\
**Post date:** [August 5, 2016, 12:37pm UTC](https://forum.zcashcommunity.com/t/zcashd-stats-and-or-logfile/1124/4 "2016-08-05T12:37:08Z")

</div>

I’ve been keeping my own log file. Stores time, time to get block, block number, difficulty once every 10 minutes.  
Execute this file log.sh with “bash log.sh” in the zcash directory:

```
#!/bin/bash
# Logs time, block num, and difficulty once every 10 minutes 
# Execute this file log.sh with "bash log.sh" in the zcash directory 
d=1
until [$d -gt 100]; do # for 100 days
  mydate=$(date +"%D")
  echo "$mydate" | tee -a log.txt # to screen & append file
  c=1
  until [$c -gt 144]; do # 24 hours
     let c=c+1
     mytime=$(date +"%T")
     block=$(src/zcash-cli getblockcount)
     difficulty=$(src/zcash-cli getdifficulty)
     difficulty=${difficulty:0:5} 
     echo "$mytime $block $difficulty" | tee -a log.txt
     sleep 600 # seconds
  done
done

```

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/vincent/32/278_2.png) [@vincent](https://forum.zcashcommunity.com/u/vincent)\
**Post date:** [August 5, 2016, 12:54pm UTC](https://forum.zcashcommunity.com/t/zcashd-stats-and-or-logfile/1124/5 "2016-08-05T12:54:55Z")

</div>

Awesome, thank you very much!

---

<div class="post-metadata">

**Author:** ![zawy](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/zawy/32/11892_2.png) [@zawy](https://forum.zcashcommunity.com/u/zawy)\
**Post date:** [August 7, 2016, 3:33pm UTC](https://forum.zcashcommunity.com/t/zcashd-stats-and-or-logfile/1124/6 "2016-08-07T15:33:29Z")

</div>

Here’s a modifed version to monitor CPU % usage (400% = 4 cores at 100%) and RAM used per core by zcashd every 15 seconds for 1 hour.

Again, assumes you’re in zcash directory

Ram per core is wrong if CPU% is not close to a multiple of 100%

Here’s the output:  
/home/zcash$ bash log.sh  
08/07/16  
time, block number, difficulty, CPU%, RAM per core  
11:28:33 313 1.000 370 596  
11:28:48 313 1.000 370 596  
11:29:03 313 1.000 370 614  
11:29:18 313 1.000 370 100  
11:29:33 313 1.000 370 89  
11:29:48 313 1.000 370 91  
11:30:03 313 1.000 370 82

Code:

```
#!/bin/bash
# Logs time, block num, difficulty, CPU%, and RAM per core once every 15 seconds for 1 hour 
# Execute this file log.sh with "bash log.sh" in the zcash directory 

memory=$(free|awk '/^Mem:/{print $2}')
memory=$(echo "$memory/1000" | bc) # integer math in bash
mydate=$(date +"%D")
echo "$mydate" | tee -a log.txt
echo "time, block number, difficulty, CPU%, RAM in MB per core" | tee -a log.txt
c=1
until [$c -gt 240]; do # for 1 hour
     let c=c+1
     mytime=$(date +"%T")
     block=$(src/zcash-cli getblockcount)
     difficulty=$(src/zcash-cli getdifficulty)
     difficulty=${difficulty:0:5}
     p=$(ps aux | grep zcashd)
     q=$(echo "$p" | tail -n1) 
     cpu=${q:16:3}
     if ["$cpu" == "0.0"]; then
         p=$(echo "$p" | tail -n2)
     fi	 	
    cpu=${p:16:3}
    ram=${p:20:4}
     rampercore=$(echo "($ram*$memory/($cpu+1)" | bc)
     echo "$mytime $block $difficulty $cpu $rampercore" | tee -a log.txt
     sleep 15 # seconds
done

```

EDIT: corrected, hopefully, to work on most systems
