Archives for category: Technology

Graylog2 rocks, however, the install instructions leave much to be desired, simply because they don’t mention any of the other required services and how those services should be setup.

I’m here to help.

This writeup is going to written for Ubuntu 10.04, however, if you’re installing graylog, I assume you know how to install packages on your linux distribution of choice.

First, we’re going to need all the prerequisite libraries and servers: mongo, elasticsearch, and the java jdk.
Here are some links that helped me:
mongodb ppa instructions for Ubuntu
Mongo user creation.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
wget https://github.com/downloads/Graylog2/graylog2-server/graylog2-server-0.9.6.tar.gz
wget https://github.com/downloads/Graylog2/graylog2-web-interface/graylog2-web-interface-0.9.6.tar.gz
tar -xzf graylog2-server-0.9.6.tar.gz
tar -xzf graylog2-web-interface-0.9.6.tar.gz
cd graylog2-server-0.9.6
cp graylog2.conf.example /etc/graylog2.conf
mv graylog2-server-0.9.6 /opt/graylog2-server/
tar -xzf graylog2-web-interface-0.9.6.tar.gz
mv graylog2-web-interface-0.9.6 /opt/graylog2-web-interface
 
# needed to compile ruby
apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion libcurl4-openssl-dev
# getting ruby for the web interface.
bash -s stable < http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages
 
# the default ubuntu mongodb is horribly broken
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" >> /etc/apt/sources.list
apt-get update && apt-get install mongodb-10gen -y
 
# bind only on the localhost
echo "bind_ip = 127.0.0.1" >> /etc/mongodb.conf
/etc/init.d/mongodb restart
 
# elasticsearch
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.7.tar.gz
tar -xzf elasticsearch-0.18.7.tar.gz
mkdir -p /data/elasticsearch/data
mv elasticsearch-0.18.7 /usr/share/elasticsearch
mkdir /etc/elasticsearch
cp /usr/share/elasticsearch/config/elasticsearch.yml /etc/elasticsearch/
 
# only bind to localhost
echo "network.bind_host: 127.0.0.1" >> /etc/elasticsearch/elasticsearch.yml

here is the upstart script for elasticsearch, from here written by tobias mcnulty, slightly modified.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# ElasticSearch Service
 
description     "ElasticSearch"
 
start on (net-device-up
          and local-filesystems
          and runlevel [2345])
 
stop on runlevel [016]
 
respawn limit 10 5
 
env ES_HOME=/usr/share/elasticsearch/
env ES_MIN_MEM=256m
env ES_MAX_MEM=2g
env DAEMON="${ES_HOME}/bin/elasticsearch"
env DATA_DIR=/data/elasticsearch/data
env CONFIG_DIR=/etc/elasticsearch
 
console output
 
script
  if [ -f /etc/default/elasticsearch ]; then
    . /etc/default/elasticsearch
  fi
 
  su -s /bin/dash -c "/usr/bin/elasticsearch -f -Des.path.conf=$CONFIG_DIR -Des.path.home=$ES_HOME -Des.path.logs=$LOG_DIR -Des.path.data=$DATA_DIR -Des.path.work=$WORK_DIR" elasticsearch
end script

setting up the mongodb user and database ( yes, I know, 123, but it’s the default, and mongodb should only be listening to loclahost.)

1
2
3
4
5
6
$ ./mongo
use admin
db.addUser("theadmin", "anadminpassword")
db.auth("theadmin","anadminpassword")
use graylog2
db.addUser("grayloguser","123")

you’ll also want to specify these values explicitly in the mongoid configuration file in the webserver. In /opt/graylog2-web-interface/config/mongoid.yml add these values, and delete the other production values.

1
2
3
4
5
6
7
# or specify values manually
production:
   host: localhost
   port: 27017
   username: grayloguser
   password: 123
   database: graylog2

the nginx upstart script

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# nginx
 
description "nginx http daemon"
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
 
env DAEMON=/opt/nginx/sbin/nginx
env PID=/opt/nginx/logs/nginx.pid
 
expect fork
respawn
 
pre-start script
        $DAEMON -t
        if [ $? -ne 0 ]
                then exit $?
        fi
end script
 
post-stop script
    start-stop-daemon --stop --pidfile $PID --name nginx --exec $DAEMON --signal TERM
end script

and this is what your /opt/nginx/conf/nginx.conf should look like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#user  nobody;
worker_processes  1;
 
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
 
pid        logs/nginx.pid;
 
events {
    worker_connections  1024;
}
 
http {
    passenger_root /opt/graylog2-web-interface/vendor/ruby/1.9.1/gems/passenger-3.0.10;
    passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.2-p290/ruby;
 
    include       mime.types;
    default_type  application/octet-stream;
 
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';
 
    #access_log  logs/access.log  main;
 
    sendfile        on;
    #tcp_nopush     on;
 
    #keepalive_timeout  0;
    keepalive_timeout  65;
 
    gzip  on;
 
server {
      listen 80;
      server_name graylog2.headliner.fm;
      root /opt/graylog2-web-interface/public;   #

I used this upstart scripts for the graylog2-server. if you copy and paste it into your /etc/init files (it’s late, if you need the exact commands, write a comment…)

now, for the magic:

1
2
3
4
/etc/init.d/mongodb start
service elasticsearch start
service graylog2-server start
service nginx start

and you’re off.

 

You develop an instant global consciousness, a people orientation, an intense dissatisfaction with the state of the world, and a compulsion to do something about it. From out there on the moon, international politics look so petty. You want to grab a politician by the scruff of the neck and drag him a quarter of a million miles out and say, “Look at that, you son of a bitch.

— Edgar Mitchell, Apollo 14 astronaut, People magazine, 8 April 1974.

High res original footage available from NASA.

Remembering that I’ll be dead soon is the most important tool I’ve ever encountered to help me make the big choices in life. Because almost everything — all external expectations, all pride, all fear of embarrassment or failure – these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart.

—Steve Jobs

2006 Stamford Commencement Address

This quote changed my life when I heard it two years ago. You will be missed, Steve, but damn, well done.

Anyone with a 3d printer, available from several different sources at prices close to or under $1,000, can now print out parts for an AR-15 assault rifle.

The AR-15 lower receiver and A 3d printable model for a 5 round magazine .

The Lower Receiver is the frame that holds together all the other pieces of the firearm. In the States, all the other pieces can be purchased without a permit – over the counter or through the post. The Lower Receiver is the only part which requires a background check or any other kind of paperwork before purchase.

Typically this part is made of aluminium. A rifle with a Lower Receiver made of plastic can be perfectly functional.

The revolution will be printed at home.

Photographs from ISS the stitched together into a fantastic short video.

This movie begins over the Pacific Ocean and continues over North and South America before entering daylight near Antarctica. Visible cities, countries and landmarks include (in order) Vancouver Island, Victoria, Vancouver, Seattle, Portland, San Fransisco, Los Angeles. Phoenix. Multiple cities in Texas, New Mexico and Mexico. Mexico City, the Gulf of Mexico, the Yucatan Peninsula, Lightning in the Pacific Ocean, Guatemala, Panama, Columbia, Ecuador, Peru, Chile, and the Amazon. Also visible is the earths ionosphere (thin yellow line) and the stars of our galaxy.

As CPU clock speeds start to level off, researchers have noticed that another power law has appeared in the electronics industry: power efficiency doubles every 18 months.

If you look at any human endeavor that enjoys the benefits of the application of tremendous amounts of determined brainpower, the metrics by which that endeavor is considered a success have a tendency to obey power laws. The periodicity of each, however, varies from field to field. See Kevin Kelly excellent research on the subject of Moore’s Law and air speed records. Processor power efficiency is the key now that portability is of the utmost importance and the rate of growth of battery storage capacity, while itself is also obeys a power law, the chemical nature of the endeavor leads to a much longer doubling time. This leads to all sorts of fun facts such as:

Imagine you’ve got a shiny computer that is identical to a Macbook Air, except that it has the energy efficiency of a machine from 20 years ago. That computer would use so much power that you’d get a mere 2.5 seconds of battery life out of the Air’s 50 watt-hour battery instead of the seven hours that the Air actually gets. That is to say, you’d need 10,000 Air batteries to run our hypothetical machine for seven hours.

Via Alexis Madrigal of the Atlantic.

These guys managed to build a side scrolling game in a brown box.

It’s a video game in a box!
Using a Teagueduino and a few inputs and outputs, we put together a physical side-scrolling video game. To control it, there’s a knob on the side. As time advances the game gets faster and faster — can you avoid all the obstacles and make it to the end?

Brilliant.