Category: Open Source Software
-
Configure nginx to log the virtual host
Nginx does not have the concept of virtual host like Apache does — nginx refers to the apache virtual host as the server. To log the requested host with each request, which makes troubleshooting when multiple sites are hosted on the same instance much easier, use the following format: log_format main ‘$remote_addr $host $remote_user [$time_local]…
-
MySQL Load Data Infile – Epoch time to Timestamp
I was recently working on a data load where I wanted to convert one column from an epoch time format into a timestamp column on import. I couldn’t figure out why the timestamp was being set to the current time on every test, no matter what I set the variables/values to. I initially tried with…
-
Proxy HTTP Requests through Nginx to Jetty6 with X-Forwarded-For
One important part of any proxy configuration is logging the correct originating IP address on the final application log to ensure proper analytics and problem determination. Note that at times, it’s very useful to log the proxy or load balancer IP at the application server to determine where an issue may be occurring but for…
-
Rewrite HTTP requests to HTTPS using Nginx
A common task is to rewrite HTTP requests to HTTPS to secure communication. Using nginx, this is easily done with: # use only https if ($scheme = http) { rewrite ^ https://$host$uri permanent; } This should be placed in a server block.
-
Compiling USB to Serial Kernel Modules on the D2Plug
I recently ordered a GlobalScale D2Plug (makers of the SheevaPlug) and needed to be able to hook up a serial device via USB. The only problem was that the installed kernel did not have the proper modules available, namely pl2303 and ftdi_sio. Although this unit was shipped running Ubuntu 10.04, performing software updates via aptitude…
-
Splitting Backups into 5GB Chunks
A common problem with cloud storage of files is that many restrict the filesize to make things more manageable. A good way to solve this problem is to use split to reduce the filesize and create multiple smaller files from a large archive. There are two primary use cases – note that these commands split…
-
Proxy Requests to Splunk with Apache 2.2
When installing Splunk on a server with existing applications and Apache already setup and running, it’s easy to add support for Splunk via mod_proxy. Although I believe it’s best to use virtual hosts to split out applications and setup proper DNS, in this example, I will be using the default virtual host (or none at…
-
AWS Adds Object Expiration to S3!
This is great news! One of the headaches of managing any file/object store is pruning old data, although that is something we’ve all dealt with for years with standard filesystems and storage devices, this makes working in the cloud easier. It’s applied by policy to a bucket (without versioning enabled). Check it out in the…
-
Enabling the binary log on a MySQL Replication Master
A common task when working with MySQL is to enable binary logging which will allow you to add read only slaves (often a good idea even if you aren’t adding the replication slaves now). According to the official MySQL documentation, there are only 3 steps required to enable binary logging: assign a unique server-id to…
-
List MySQL Table Space Consumption
How much space is MySQL consuming? How do I find out which MySQL tables are the largest? Can I query MySQL to determine how much space it’s consuming? Try this to list the top 20 space offenders: SELECT engine, concat( table_schema, ‘.’, table_name ) table_name, concat( round( data_length / ( 1024 *1024 ) , 2…