grep ps output instead of pgrep

For some reason, pgrep fails to match the PID and write it to file. In my environment, the following command
```bash
pgrep -f "/usr/bin/java -Xmx256m -Djava.io.tmpdir=/usr/share/logstash/tmp -Xmx384m -XX:+UseConcMarkSweepGC -jar /usr/share/logstash/logstash.jar agent --config /etc/logstash/indexer/config --log /var/log/logstash/logstash-indexer.log -w 4"
```
returns nothing, whereas
```bash
ps e | grep "/usr/bin/java -Xmx256m -Djava.io.tmpdir=/usr/share/logstash/tmp -Xmx384m -XX:+UseConcMarkSweepGC -jar /usr/share/logstash/logstash.jar agent --config /etc/logstash/indexer/config --log /var/log/logstash/logstash-indexer.log -w 4" | grep -v grep | awk '{print $1}'
```
reliably locates the PID.