summaryrefslogtreecommitdiffstats
path: root/demo/loggen.py
diff options
context:
space:
mode:
Diffstat (limited to 'demo/loggen.py')
-rwxr-xr-xdemo/loggen.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/demo/loggen.py b/demo/loggen.py
new file mode 100755
index 0000000..6790a09
--- /dev/null
+++ b/demo/loggen.py
@@ -0,0 +1,54 @@
+import datetime
+import os
+import random
+import shutil
+import sys
+
+MSGS = [
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
+ "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
+ "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
+ "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
+]
+
+GLOG_DATE_FMT = "%Y%m%d %H:%M:%S"
+
+START_TIME = datetime.datetime.fromtimestamp(1490191111)
+
+try:
+ shutil.rmtree("/tmp/demo")
+ os.makedirs("/tmp/demo")
+except OSError:
+ pass
+
+PIDS = [
+ "123",
+ "123",
+ "123",
+ "121",
+ "124",
+ "123",
+ "61456",
+ "61456",
+ "61457",
+]
+
+LOG_LOCS = [
+ "demo.cc:123",
+ "demo.cc:352",
+ "loader.cc:13",
+ "loader.cc:552",
+ "blaster.cc:352",
+ "blaster.cc:112",
+ "blaster.cc:6782",
+]
+
+CURR_TIME = START_TIME
+for _index in range(0, int(sys.argv[1])):
+ CURR_TIME += datetime.timedelta(seconds=random.randrange(1, 22))
+ print("I%s.%06d %s %s] %s" % (
+ CURR_TIME.strftime(GLOG_DATE_FMT),
+ random.randrange(0, 100000),
+ random.choice(PIDS),
+ random.choice(LOG_LOCS),
+ random.choice(MSGS)))