To log all queries we need to use Event Listeners class QueryDebuggerListener extends Doctrine_EventListener { public function preStmtExecute(Doctrine_Event $event) { $q = $event->getQuery(); $params = $event->getParams(); while (sizeof($params) > 0) { $param = array_shift($params); if (!is_numeric($param)) { $param = sprintf(“‘%s'”, $param); } $q = substr_replace($q, $param, strpos($q, ‘?’), 1); } error_log($q); } } $queryDbg =Continue reading “Doctrine 1.x log all queries”
Monthly Archives: February 2014
Restore #AWS RDS instance from a database snapshot by using AWS CLI
The AWS Command Line Interface is a unified tool to manage your AWS services. I am using AWS RDS PostgreSQL for my application. I don’t need to run this application 24/7/365. So I have the ability to stop periodically my instances to save some money in my pocket. Nobody wants to do repeated tasks manually.Continue reading “Restore #AWS RDS instance from a database snapshot by using AWS CLI”
EC2 Instance Metadata Query Tool
On Ubuntu, you can use the ec2metadata script to query the EC2 instance Metadata from within a running EC2 instance. $ ec2metadata ami-id: ami-00000000 ami-launch-index: 0 ami-manifest-path: (unknown) ancestor-ami-ids: unavailable availability-zone: us-east-1a block-device-mapping: ami root instance-action: none instance-id: i-00000000 instance-type: rus1.universe local-hostname: ip-10-72-174-90.ec2.internal local-ipv4: 10.72.174.90 kernel-id: aki-88aa75e1 mac: unavailable profile: default-paravirtual product-codes: unavailable public-hostname: ec2-00-000-000-000.compute-1.amazonaws.comContinue reading “EC2 Instance Metadata Query Tool”
How to relaunch CloudInit script
sudo rm /var/lib/cloud/sem/* sudo /etc/init.d/cloud-init start