I have my output below:
ps -ef | grep logstash
kafka 2832 1 1 Oct06 ? 08:18:36 /usr/bin/java -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -Djava.awt.headless=true -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Xmx1g -Xss2048k -Djffi.boot.library.path=/apps/COMPASSLOG_DEV/logstash-2.2.2/vendor/jruby/lib/jni -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -Djava.awt.headless=true -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/apps/COMPASSLOG_DEV/logstash-2.2.2/heapdump.hprof -Xbootclasspath/a:/apps/COMPASSLOG_DEV/logstash-2.2.2/vendor/jruby/lib/jruby.jar -classpath : -Djruby.home=/apps/COMPASSLOG_DEV/logstash-2.2.2/vendor/jruby -Djruby.lib=/apps/COMPASSLOG_DEV/logstash-2.2.2/vendor/jruby/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main --1.9 /apps/COMPASSLOG_DEV/logstash-2.2.2/lib/bootstrap/environment.rb logstash/runner.rb agent -f /apps/COMPASSLOG_DEV/COMPASSLOG_DEV.config
I have used the script below to make it look clean:
ps -ef | grep logstash | grep -v grep | grep -v nohup|awk '{print $38}'|awk -F/ '{print $3}'|awk -F_ '{print "Logstash is running for: "$1$2}'
which gives me output:
Logstash is running for: COMPASSLOGDEV
How can I add the port number its running on as below?
Logstash is running for: COMPASSLOGDEV on port number 2832
^^^^^^^^^^^^^^^^^^^ add this