Skip to content

Instantly share code, notes, and snippets.

@heinrichvk
Last active October 2, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heinrichvk/08681d6a7e30f616e2e1 to your computer and use it in GitHub Desktop.
Save heinrichvk/08681d6a7e30f616e2e1 to your computer and use it in GitHub Desktop.
Scripts for loading data into Splunk, with tags.
#!/bin/bash
#2015-06-24T00:00:00Z = 1435093200000 ms
#2015-06-25T00:00:00Z = 1435179600000 ms
echo "temperature, humidity, precipitation, timestamp, location, type, host" >> splunk_tags
for (( i = 1435093200000; i < 1435179600000; i+=10000 )); do
for ((q = 1; q < 101; q++)); do
v=$[100 + (RANDOM % 100)]$[1000 + (RANDOM % 1000)]
t=$[20 + RANDOM % 20].${v:1:2}${v:4:3}
p=$[0 + RANDOM % 3].${v:1:2}${v:4:3}
h=$[20 + RANDOM % 60].${v:1:2}${v:4:3}
rem=$(( $q % 3 ))
if [ $rem -eq 0 ]
then
echo "$t, $h, $p, $i, SVL, analog, sensor$q" >> splunk_tags
else
if [ $rem -eq 1 ]
then
echo "$t, $h, $p, $i, ORE, digital, sensor$q" >> splunk_tags
else
echo "$t, $h, $p, $i, NYC, unknown, sensor$q" >> splunk_tags
fi
fi
done;
done
echo "Data generated"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment