<commit_before>#!/bin/bash

if [ -z "$1" ]
then
        echo "Date required." >&2
        exit 1
fi

input="$@"
date=`date -d "$input" "+%Y-%m-%d %R"`

if [ $? -ne 0 ]
then
        echo "Invalid date." >&2
        exit 1
fi

if [ -z METERING_REQUEST_DIR ]
then
        echo "METERING_REQUEST_DIR not set." >&2
        echo "Defaulting to /poseidon/stor/metering/request." >&2
        METERING_REQUEST_DIR=/poseidon/stor/metering/request
fi

scripts="/opt/smartdc/mackerel/scripts"
keygen=$scripts/request/keygen.sh

year=`date -d "$date" +%Y`
month=`date -d "$date" +%m`
day=`date -d "$date" +%d`
hour=`date -d "$date" +%H`
request_path=$METERING_REQUEST_DIR/$year/$month/$day/$hour

mmkdir $METERING_REQUEST_DIR/$year
mmkdir $METERING_REQUEST_DIR/$year/$month
mmkdir $METERING_REQUEST_DIR/$year/$month/$day
mmkdir $METERING_REQUEST_DIR/$year/$month/$day/$hour

map=(
        'bzcat | '
        'bunyan -j --strict '
                '-c "this.audit == true && this.req.url != '\''/ping'\''" | '
        'json -ga req.owner req.method '
                'req.headers.content-length res.headers.content-length | '
        'awk '\''{ '
                'if($2 == "GET") { '
                        'gets[$1] += 1; '
                        'if ($3) { '<commit_msg>MANTA-195: minor: typo<commit_after>#!/bin/bash

if [ -z "$1" ]
then
        echo "Date required." >&2
        exit 1
fi

input="$@"
date=`date -d "$input" "+%Y-%m-%d %R"`

if [ $? -ne 0 ]
then
        echo "Invalid date." >&2
        exit 1
fi

if [ -z $METERING_REQUEST_DIR ]
then
        echo "METERING_REQUEST_DIR not set." >&2
        echo "Defaulting to /poseidon/stor/metering/request." >&2
        METERING_REQUEST_DIR=/poseidon/stor/metering/request
fi

scripts="/opt/smartdc/mackerel/scripts"
keygen=$scripts/request/keygen.sh

year=`date -d "$date" +%Y`
month=`date -d "$date" +%m`
day=`date -d "$date" +%d`
hour=`date -d "$date" +%H`
request_path=$METERING_REQUEST_DIR/$year/$month/$day/$hour

mmkdir $METERING_REQUEST_DIR/$year
mmkdir $METERING_REQUEST_DIR/$year/$month
mmkdir $METERING_REQUEST_DIR/$year/$month/$day
mmkdir $METERING_REQUEST_DIR/$year/$month/$day/$hour

map=(
        'bzcat | '
        'bunyan -j --strict '
                '-c "this.audit == true && this.req.url != '\''/ping'\''" | '
        'json -ga req.owner req.method '
                'req.headers.content-length res.headers.content-length | '
        'awk '\''{ '
                'if($2 == "GET") { '
                        'gets[$1] += 1; '
                        'if ($3) { '
{'fraction_non_alphanumeric': 0.185126582278481, 'fraction_numerical': 0.010680379746835443, 'mean_word_length': 2.3276315789473685, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4408248', 'n_tokens_mistral': 980, 'n_tokens_neox': 935, 'n_words': 192}