Last active
June 24, 2016 14:59
-
-
Save suhlig/62c114b836ba717c8a7ccccf8f07a84d to your computer and use it in GitHub Desktop.
Parsing cloud controller logs with jq (also converts time stamps to be human-readable)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat cloud_controller_ng.log | jq -r '{timestamp: .timestamp|todate, source, message, loc: [.file, .lineno|tostring] | join(":")} | join(" - ")' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"timestamp":1465979586.4876711,"message":"db config {:database=>\"postgres://ccadmin:[email protected]:5524/ccdb\", :max_connections=>25, :pool_timeout=>10, :log_level=>\"debug2\"}","log_level":"info","source":"cc.runner","data":{},"thread_id":47031992007060,"fiber_id":47032007808540,"process_id":2993,"file":"/var/vcap/data/packages/cloud_controller_ng/e8bba5b0fe019ed1249b56ead91381fdb4e2a4ce.1-a66660c63728744c285fa64e7cdd767eeb7d69e3/cloud_controller_ng/lib/cloud_controller/runner.rb","lineno":177,"method":"setup_db"} | |
{"timestamp":1465979586.60985,"message":"(0.000167s) SET standard_conforming_strings = ON","log_level":"debug2","source":"cc.db","data":{},"thread_id":47031992007060,"fiber_id":47032007808540,"process_id":2993,"file":"/var/vcap/packages/cloud_controller_ng/cloud_controller_ng/vendor/bundle/ruby/2.2.0/gems/sequel-4.21.0/lib/sequel/database/logging.rb","lineno":70,"method":"block in log_each"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2016-06-15T08:33:06Z - cc.runner - db config {:database=>"postgres://ccadmin:[email protected]:5524/ccdb", :max_connections=>25, :pool_timeout=>10, :log_level=>"debug2"} - /var/vcap/data/packages/cloud_controller_ng/e8bba5b0fe019ed1249b56ead91381fdb4e2a4ce.1-a66660c63728744c285fa64e7cdd767eeb7d69e3/cloud_controller_ng/lib/cloud_controller/runner.rb:177 | |
2016-06-15T08:33:06Z - cc.db - (0.000167s) SET standard_conforming_strings = ON - /var/vcap/packages/cloud_controller_ng/cloud_controller_ng/vendor/bundle/ruby/2.2.0/gems/sequel-4.21.0/lib/sequel/database/logging.rb:70 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Superseded by cf-loghumanize