Wednesday, June 26, 2013

Conditional logging in Apache 2

Sometimes Apache 2’s logs can get really polluted by entries which you don’t care about and might skew your statistics. For example you wouldn’t want your own IP address in the logs because you don’t want that counted in the statistic. Although most web analyzers have filters to exclude such things, you can do this directly in Apache by not logging these. To do this you first need to set and environment variable that matches what you don’t want to log - this can use regular expressions and the matching is done on HTTP header fields like Remote_Addr or Request_URI.
Let’s say you want to exclude all internal IPs in your company from your website’s logs. You need to add this to your httpd.conf or domain_name.conf, depending on how you have your web server set up:

SetEnvIf Remote_Addr "10\.*\.*\.*" nologging
 
This just created a new variable in Apache’s environment called “nologging”. Now we will add this to the log directive in the same config file:

CustomLog log/access.log  combined env=!nologging
 
Now Apache will log everything except what is matched with the rule above. If you want to add more things to the list of non-logging, we can just continue adding rules to that variable. Let’s assume we decided not to add the favicon.ico requests to the log:

SetEnvIf Request_URI "^/favicon\.ico$" nologging
 
That’s it, no more pesky favicon requests in the logs! As you can see, the rules are pretty powerful and there are many uses for this! Also, don’t forget that you need the “log_config” and the “setenvif” module loaded in Apache! As usual you can check this using httpd -M or apache2 -M on the command line.
For more details: http://httpd.apache.org/docs/2.2/mod/mod_log_config.html

Tuesday, June 25, 2013

Moodle java script issue

Moodle has cached its own. So sometime will effected to javascript, here is the error I got when using firebug:

Uncaught TypeError: Cannot call method 'load_flowplayer' of undefined
On the httpd access_log file, you may see

192.168.0.100 - - [25/Jun/2013:10:25:11 +0400] "GET /moodle/theme/image.php/_s/cover/theme/1372141187/leaves0 HTTP/1.1" 404 674 "http://domain.com/moodle/theme/index.php?lang=en" "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)" 0

To fix it, please clear cache with www.yourdomain.com/moodle/admin/purgecaches.php 

Done.

Tuesday, June 4, 2013

How to Fix Temporary Profile in Windows 7

http://www.sysprobs.com/fix-temporary-profile-windows-7

Sometimes Windows 7 OS may not read your correct user profile properly, instead, load with temporary profile which will look completely different.  If you are not aware of temp profile or missed to see the pop-up message at bottom right side of the screen, then really you will be surprised to see completely different and new desktop without your files,folders,shortcut icons and any customized settings.This guide shows how to fix temporary profile issue on Windows 7.
“You have been logged on with Temporary profile”- that’s the famous message from Windows 7. Even though this article was published back in 2010, I’m rewriting this again on August 2012 with more information, inputs, related links and the experience I had on this issue for last two years in domain and workgroup environment.

Why Windows 7 Loads with Temporary Profile?

Obviously, your profile (the files and folders located under C:\Users\user_name) is corrupted. There is another chance which is a delay in reading your profile files due to Antivirus scan or something else during boot up. Usually after typing your user name and password Windows tries to read and load your profile, if it gets corrupted or delay in reading, Windows will load with temp profile to give temporary access on computer.