<commit_before>#!/bin/bash

echo "Waiting for Graylog webinterface...."

until $(curl --output /dev/null --silent --head --fail -u admin:admin http://localhost:12900/system); do
    echo 'Waiting some more...'
    sleep 5
done


set -e

echo "Graylog webinterface is ready"


for file in /opt/content-packs/*.json; do
    echo "Installing content-pack: $file"; 
    uri=$(curl -s -v -u admin:admin -X POST -H "Content-Type: application/json" -d "@${file}" http://localhost:12900/system/bundles 2>&1 | grep "Location" | awk '{ print $3 }' | tr -d '\r')

    echo "Content pack uri: ${uri}"
    enableUri="${uri}/apply"

    echo "Enabling content-pack: ${enableUri}"
    curl -s -v -u admin:admin -X POST $enableUri
done


touch /opt/content-packs-installed<commit_msg>Wait a few seconds after rest interface coming online before installing content packs<commit_after>#!/bin/bash

echo "Waiting for Graylog webinterface...."

until $(curl --output /dev/null --silent --head --fail -u admin:admin http://localhost:12900/system); do
    echo 'Waiting some more...'
    sleep 5
done


set -e

echo "Graylog webinterface seems to be ready ready"
sleep 5 # Just to be safe... 


for file in /opt/content-packs/*.json; do
    echo "Installing content-pack: $file"; 
    uri=$(curl -s -v -u admin:admin -X POST -H "Content-Type: application/json" -d "@${file}" http://localhost:12900/system/bundles 2>&1 | grep "Location" | awk '{ print $3 }' | tr -d '\r')

    echo "Content pack uri: ${uri}"
    enableUri="${uri}/apply"

    echo "Enabling content-pack: ${enableUri}"
    curl -s -v -u admin:admin -X POST $enableUri
done


touch /opt/content-packs-installed
{'fraction_non_alphanumeric': 0.15849969751966123, 'fraction_numerical': 0.017543859649122806, 'mean_word_length': 3.1662468513853903, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3066687', 'n_tokens_mistral': 583, 'n_tokens_neox': 530, 'n_words': 186}