How to get system encoding under Linux

Well, the problem is that you want to know what is the current system encoding under your linux server, but it’s not a system setting, rather a terminal setting. To know which is the terminal encoding just type:

echo $LC_CTYPE

If you want to know the terminal language type:

echo $LANG

To list all the configuration, just type:


And, least but not last, if you want to change the encoding type:

export LC_ALL=en_US.UTF-8
export LANG="$LC_ALL"

ModSecurity and Logrotate

As you may have read, we are using ModSecurity to filter out bad HTTP requests on our servers. In this little post you will learn how to integrate ModSecurity and Logrotate to work effectively together.

One of this technology’s fallback is that it logs an incredible amount of data to /var/log/modsec_audit.log (all this data is useful for debugging purposes, so we do not want to avoid logging at all)… The size of this file at the end of the day is HUGE…

To avoid this we have created a new logrotate script that handles all the work. To install it under CentOS type

vi /etc/logrotate.d/modsecurity

then insert the following lines:

/var/log/modsec_audit.log {
    rotate 1
        /sbin/service httpd reload > /dev/null 2>/dev/null || true

No need to restart, it does everything when logrotate runs by itself…

To complete the scenario, let’s have a look to the lines we have written:

rotate 1

tells logrotate to keep ONLY 1 copy of the file. This means that today at 4 am logrotates deletes the file modsec_audit.log.1.gz and creates a new one starting from modsec_audit.log.


means that we do want a compressed archive of the file

    /sbin/service httpd reload > /dev/null 2>/dev/null || true

forces a restart of Apache.