pull log with http method.refer to:how-can-i-follow-a-file-like-tail-f-does-in-java-without-holding-the-file-open this has been use in qipeng.com 3 years,it's reliable
- 1.package with package.sh. need maven2/3 ,java7
- 2.start cmd,default port is 11456 :
java -Xms256m -Xmx512m -XX:PermSize=96m -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps
-Xloggc:/home/admin/log-agent/log/agent-gc.log -XX:+HeapDumpOnOutOfMemoryError
-classpath log-agent.jar com.taovip.agent.AgentStartUp [port]
- 3.add tail log : curl 'http://127.0.0.1:11456/addFile?filePath=/tmp/tmp.log&charset=utf-8'
- 4.tail log : curl 'http://127.0.0.1:11456/log2?filePath=/tmp/tmp.log'
- 5.list tailing log : curl 'http://127.0.0.1:11456/listFiles'