genhttplogs - Node.js script that generates HTTP access logs

In my previous tutorial regarding D3.js World Map Real-Time Data Visualizations I have built a basic Node.js script to generate HTTP access log only with IP addresses.

I wasn't too happy with it and wrote a better one using faker and strftime packages, its output is now similar to the Ruby script and closer to a real Apache access log.

You can download this script from my GitHub, I've created over there a new project called genhttplogs.

Installation
git clone https://github.com/mihailj/genhttplogs.git
cd genhttplogs
npm install
Usage
npm start [speed] -s
npm start [speed] -s >> access.log

[speed] = optional parameter; float; ex: 20, 0.5, etc...; lower is slower

Output
107.221.23.250 - - [14/Jun/2016:18:11:18 +0000] "GET /withdrawal_microchip_movies.php HTTP/1.1" 200 6254 "-" "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; Touch; rv:11.0) like Gecko"
2.33.153.37 - - [14/Jun/2016:18:11:33 +0000] "GET /24/365_hardware.html HTTP/1.1" 200 1374 "-" "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko"
133.16.196.204 - - [14/Jun/2016:18:11:33 +0000] "GET /ergonomic_metal_sausages_panel_ram.gif HTTP/1.1" 200 2836 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.0) AppleWebKit/532.1.2 (KHTML, like Gecko) Chrome/36.0.899.0 Safari/532.1.2"
...

Leave a Reply

Your email address will not be published. Required fields are marked *