Technology Errors

last: btmp: File too large, Read Large btmp Files

Earlier today while investigating the logs on a CentOS Linux server I noticed the btmp file had grown to over 5GB. I was curious to look into the log and when attempting to read the 5GB file using last I received an error since last will only handle files that are 2GB in size or less. So what needs to happen is to split the file into multiple pieces so they can be read via the last command. Below I describe the error in detail, how to resolve it by splitting the btmp file into multiple files, and then how to join them together if you need to read logs older than the last split file.

Code Snippets

Postfix Logrotate Script For Gentoo Linux

Working on a friends server earlier this morning I noticed that he had logrotate configured but he did not have a configuration file for Postfix. Below is the quick one I whipped up for his environment including a brief explanation of each line of the configuration file below the script. Following the explanation of the various configurations is the command to actually force logrotate to run in debug mode so you can see what happens.

Technology Insights

Configure Logrotate To Rotate And Flush MySQL Logs Without A Password

If you have the resources (CPU + RAM) available on your server then its can be a great troubleshooting tool if you enable MySQL logging which includes server messages, SQL query logs, and slow query logs. If you do not have the resources I would suggest only enable minimal logging such as only server messages and the slow query log since enabling all queries to be written to a file can become expensive rather quickly. Below I discuss enabling three different types of MySQL logging, adding a MySQL configuration file to logrotate, and configuring root to run mysqladmin commands without having to type the password out each time.

Code Snippets

Ruby Script to Update Github Repos and Fetch Changesets for Redmine

I recently started using Redmine for numerous projects and could not be happier with the application so far. Not only is it actively developed and already includes a ton of great features but it doesn’t seem bloated at all. Many of the projects I have configured for Redmine have their code base stored on Github so I needed to find a way to add code updates that referenced tickets to the tickets themselves. At first I was having a bit of trouble understanding exactly how this should be achieved but after digging around it ended up being pretty easy. You will need to configure local repos underneath your Redmine project that are updated fairly regularly and then after they are updated you will need to run a script that updates the any ticket that code has been associated with.