Saturday, February 23, 2013

Lighttpd - Access log

Lighttpd have an access log, but it's disabled by default.

Activate access log
To actite it you have to modify the configuration file:
"/etc/lighttpd/lighttpd.conf"

Where you have to activate the mod_accesslog module:

server.modules = (
...
"mod_accesslog"
...
)

And define the access log path, exemple: 
accesslog.filename             = "/var/log/lighttpd/access.log"

Reading the log
The log will be written in the defined file. Every week, the file will be saved as "access.log.2.gz" and a new "access.log" file will be created.

Log Format
Log lines are defined like that by default:
address of remote-host adress of the server user timestamp "request" status code bytes sent "Referer adress" "User-Agent"

1?.6?.1?.1? www.htcpcp.net - 23/Jan/2013:07:13:56 +0000 "GET / HTTP/1.1" 200 1371 "http://www.error418.fr/" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"

When I decided to check of my server log, I didn't thought to find something interesting in it. But reading this log was much more exciting than I thought, making me discover a universe populated by Agents Robots, Nerds and Pirates who will the topic of future posts.

Saturday, February 9, 2013

Debug the teapot - Enabling the 418 return code

I have found a simple a way to correct the lack of 418 return code.
There are php commands to control the return code in the header.

But to use it I first had to install PHP for my lighttpd server with this command:
"sudo apt-get install lighttpd php5-cgi"

After that I had to enable it in the server with these 2 commands
"sudo lighty-enable-mod fastcgi" "sudo lighty-enable-mod fastcgi-php"

After that I have renamed my index.html for index.php and then I have added this PHP code to my page.
"<?php
header("I'm a teapot!", true, 418);
?>"

Here is the result in the Firefox debuging console


Thursday, January 31, 2013

Raspberry Pi power consumption - One month after


Here is the end of January  As promised, I'll do a checkpoint about my Raspberry pi power consumption.

My consometer measured a total power consumption of 1,8 kWh, this is absolutely very low.

I'll do another measure in two month for confirmation.




Crédit photo: M. G. Loppé [Public domain], via Wikimedia Commons

Sunday, January 20, 2013

A bug on the teapot - Firefox Debugging tools



I received an email from a visitor telling me there is a bug on the site of my teapot.
In summary, he told me that the debugger says him that my teapot it returns him a code 200 instead of a 418 code.

But how to check the presence of this bug by myself? I explored the development tools in the Firefox menu to find the option "Web Developer / Web Console".




This tool displays some technical informations about the current page in a banner that appears at the bottom (remember to refresh the page if nothing is displayed)




Indeed, the return code 200 is the code sent after a HTTP request accepted by the server. My teapot hosting a web server, it returns this return code when you visit my page.

It is also noticed traces of my usage of Google Analytics with this tool.

Now that I'm aware of this failure, I'll try to find a way to return a true 418 code in a future post.

Sunday, January 6, 2013

Raspberry Pi power consumption - One week after

Here is a first checkpoint about the power consumption of my Raspberry Pi.
Today, after one week of measuring my powermeter announces a total consumption of 0.4 kWh.
Given the low power consumption and the poor accuracy of the tool, I'll do the next measure at the end of the month.




Credit photo: Thomas Bresson (originally posted to Flickr as Eclair) [CC-BY-2.0 (http://creativecommons.org/licenses/by/2.0)], via Wikimedia Commons





Tuesday, January 1, 2013

Raspberry Pi power consumption

To start the new year, I decided to look at the power consumption of the project.

I found a power meter in my stuffs, which is probably not very accurate, but should allow me to give an idea of what consumes and costs my Raspberry Pi. I want to take into account the conversion from 240 Volts to 5 Volts.
My power meter is the MPM 50 model of brand IDK.

Due to the low consumption of Rasperry Pi, it is possible that the power meter consumption is significant. According to the manual it consumes less than 2 watts.

The experiment just started, so I have didn't accumulated cumulative consumption yet, but here are the first informations on the instantaneous data given by the device:
237 Volts
0,02 Ampères
2,5 Watts

For your information, the regulated tariff for electricity from EDF (Electricité de France) is € 0.0812 per kWh excluding taxes and € 0.1249 per kWh including taxes.

I'll try to give regular updates on measured consumption.

Tuesday, December 18, 2012

Looking for a good power adapter


As my server works 24/7, I spent a bit of time to find a good power supply for my Raspberry Pi

Recommendations for the Raspberry Pi are to use an 5V 700mA USB power adapter .

So I checked my stuff for what USB chargers I already had. I found several alimentions 500mA and 1000mA. They all work with my Raspberry Pi, but I feel these alimentations become too hot after a long usage.

So I started looking for a bit more powerful adapter, thinking that an over-sized power adapter should help to reduce heating and improve the life of the power adapter and of the Rasperry Pi

I found several chargers over 2000mA on the Internet, some with two USB ports, like this one, brand Bluestork:

Others with 1 USB port, like this one, brand Re-volt:


I have a preference for a model with one USB port, as some 2000mA models with 2 USB ports are in fact 2 x 1000mA

But ultimately, I chose this one, brand Apple:
€ 19.99 is a bit expensive for a power adapter, but it fits in the budget of the project. I found it in a local shop and I therefore saved shipping cost. In addition, the brand is well known, and I think I can benefit from the guarantee in case of problems.

After 2 days of usage, I feel this one a bit less hot than my older one.

Impact on the project: -19.90€