<commit_before>Cloudflare to Apache
=====================

A small script to convert [Cloudflare](http://www.cloudflare.com) log format to match that of [Apache](http://httpd.apache.org). So you can import the logs into things like [Piwik](http://piwik.org).

# Cloudflare format

```
host<space>IP<space>Request timestamp<space>"Request"<space>Response code<space>Response time<space>"User Agent"<space>"Bot?"<space>"Referrer"
```

# Apache format

```
IP - - [Request date string]<space>"Request"<space>Response code<space>-<space>"Referrer"<space>"User agent"
```

# Usage

## Simple 

```bash
npm i -g cloudflare-to-apache
cloudflare-to-apache < inpuFile > outputFile
```

## Manual

```bash
node index < $inputFile > $outputFile
```

## Outputting to a file

```bash
DEBUG=* node index apache.log < $inputFile
```

`DEBUG=*` outputs debug information to the terminal.

# Status

Tests currently run fine on Ubuntu (14.04) and OSX, not sure why they aren't running on travisci. Need to investigate and fix.

[![Build Status](https://secure.travis-ci.org/surevine/cloudflare-to-apache.svg)](http://travis-ci.org/surevine/cloudflare-to-apache)

[![Dependency Status](https://david-dm.org/surevine/cloudflare-to-apache.svg)](https://david-dm.org/surevine/cloudflare-to-apache)
<commit_msg>Update README to talk about running with old format<commit_after>Cloudflare to Apache
=====================

A small script to convert [Cloudflare](http://www.cloudflare.com) log format to match that of [Apache](http://httpd.apache.org). So you can import the logs into things like [Piwik](http://piwik.org).

# Cloudflare format

## Old format

```
host<space>IP<space>Request timestamp<space>"Request"<space>Response code<space>Response time<space>"User Agent"<space>"Bot?"<space>"Referrer"
```

# Apache format

```
IP - - [Request date string]<space>"Request"<space>Response code<space>-<space>"Referrer"<space>"User agent"
```

# Usage

## Simple 

```bash
npm i -g cloudflare-to-apache
cloudflare-to-apache < inputFile > outputFile
```

To convert the older style format simply do:

```bash
cloudflare-to-apache -f old < inputFile > outputFile
```

## Manual

```bash
node index < $inputFile > $outputFile
```

## Outputting to a file

```bash
DEBUG=* node index apache.log < $inputFile
```

`DEBUG=*` outputs debug information to the terminal.

# Status

Tests currently run fine on Ubuntu (14.04) and OSX, not sure why they aren't running on travisci. Need to investigate and fix.

[![Build Status](https://secure.travis-ci.org/surevine/cloudflare-to-apache.svg)](http://travis-ci.org/surevine/cloudflare-to-apache)

[![Dependency Status](https://david-dm.org/surevine/cloudflare-to-apache.svg)](https://david-dm.org/surevine/cloudflare-to-apache)

{'fraction_non_alphanumeric': 0.16751638747268754, 'fraction_numerical': 0.0029133284777858705, 'mean_word_length': 5.257403189066059, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 34, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1286594', 'n_tokens_mistral': 957, 'n_tokens_neox': 868, 'n_words': 226}