mirror of
https://github.com/tstack/lnav.git
synced 2024-08-17 00:40:30 +03:00
[release] add a log generator for demo purposes
This commit is contained in:
parent
a76803fd44
commit
865951739e
@ -5,7 +5,9 @@ SUBDIRS = src test
|
||||
|
||||
noinst_SCRIPTS = TESTS_ENVIRONMENT
|
||||
|
||||
dist_man_MANS = lnav.1
|
||||
|
||||
EXTRA_DIST = \
|
||||
AUTHORS \
|
||||
LICENSE \
|
||||
README.md
|
||||
README.md
|
||||
|
106
Makefile.in
106
Makefile.in
@ -81,8 +81,9 @@ host_triplet = @host@
|
||||
subdir = .
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/configure $(am__configure_deps) mkinstalldirs \
|
||||
$(srcdir)/TESTS_ENVIRONMENT.in AUTHORS INSTALL NEWS README \
|
||||
compile config.guess config.sub depcomp install-sh missing
|
||||
$(srcdir)/TESTS_ENVIRONMENT.in $(dist_man_MANS) AUTHORS \
|
||||
INSTALL NEWS README compile config.guess config.sub depcomp \
|
||||
install-sh missing
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/ax_sqlite3.m4 \
|
||||
$(top_srcdir)/ax_with_curses.m4 $(top_srcdir)/lnav.m4 \
|
||||
@ -123,6 +124,37 @@ am__can_run_installinfo = \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
man1dir = $(mandir)/man1
|
||||
am__installdirs = "$(DESTDIR)$(man1dir)"
|
||||
NROFF = nroff
|
||||
MANS = $(dist_man_MANS)
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
am__recursive_targets = \
|
||||
@ -321,10 +353,11 @@ top_srcdir = @top_srcdir@
|
||||
ACLOCAL_AMFLAGS = -I .
|
||||
SUBDIRS = src test
|
||||
noinst_SCRIPTS = TESTS_ENVIRONMENT
|
||||
dist_man_MANS = lnav.1
|
||||
EXTRA_DIST = \
|
||||
AUTHORS \
|
||||
LICENSE \
|
||||
README.md
|
||||
README.md
|
||||
|
||||
all: all-recursive
|
||||
|
||||
@ -365,6 +398,49 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__aclocal_m4_deps):
|
||||
TESTS_ENVIRONMENT: $(top_builddir)/config.status $(srcdir)/TESTS_ENVIRONMENT.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
install-man1: $(dist_man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list1=''; \
|
||||
list2='$(dist_man_MANS)'; \
|
||||
test -n "$(man1dir)" \
|
||||
&& test -n "`echo $$list1$$list2`" \
|
||||
|| exit 0; \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
|
||||
{ for i in $$list1; do echo "$$i"; done; \
|
||||
if test -n "$$list2"; then \
|
||||
for i in $$list2; do echo "$$i"; done \
|
||||
| sed -n '/\.1[a-z]*$$/p'; \
|
||||
fi; \
|
||||
} | while read p; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; echo "$$p"; \
|
||||
done | \
|
||||
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
|
||||
sed 'N;N;s,\n, ,g' | { \
|
||||
list=; while read file base inst; do \
|
||||
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
|
||||
fi; \
|
||||
done; \
|
||||
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
|
||||
done; }
|
||||
|
||||
uninstall-man1:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list=''; test -n "$(man1dir)" || exit 0; \
|
||||
files=`{ for i in $$list; do echo "$$i"; done; \
|
||||
l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||
sed -n '/\.1[a-z]*$$/p'; \
|
||||
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
|
||||
dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run 'make' without going through this Makefile.
|
||||
@ -661,9 +737,12 @@ distcleancheck: distclean
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile $(SCRIPTS)
|
||||
all-am: Makefile $(SCRIPTS) $(MANS)
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
for dir in "$(DESTDIR)$(man1dir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
@ -715,7 +794,7 @@ info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
install-data-am: install-man
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
@ -731,7 +810,7 @@ install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
install-man: install-man1
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
@ -761,7 +840,9 @@ ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
uninstall-am: uninstall-man
|
||||
|
||||
uninstall-man: uninstall-man1
|
||||
|
||||
.MAKE: $(am__recursive_targets) install-am install-strip
|
||||
|
||||
@ -774,11 +855,12 @@ uninstall-am:
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||
pdf-am ps ps-am tags tags-am uninstall uninstall-am
|
||||
install-info-am install-man install-man1 install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs installdirs-am \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
|
||||
uninstall-am uninstall-man uninstall-man1
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
|
4
NEWS
4
NEWS
@ -24,6 +24,8 @@ lnav v0.7.0:
|
||||
to a JSON-formatted file.
|
||||
* The "elapsed time" column now uses red/green coloring to indicate
|
||||
sharp changes in the message rate.
|
||||
* Added a "set-min-log-level" command to filter out log messages that
|
||||
are below a given level.
|
||||
|
||||
Fixes:
|
||||
* Performance improvements.
|
||||
@ -47,6 +49,8 @@ lnav v0.7.0:
|
||||
command-prompt. The matches are now shown in a separate view and
|
||||
pressing tab repeatedly will scroll through the view.
|
||||
* The "open" command now does shell word expansion for file names.
|
||||
* More config directory paths have been added: /etc/lnav,
|
||||
$prefix/etc/lnav, and directories passed on the command-line with -I.
|
||||
|
||||
lnav v0.6.2:
|
||||
Features:
|
||||
|
158
release/loggen.py
Executable file
158
release/loggen.py
Executable file
@ -0,0 +1,158 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import uuid
|
||||
import shutil
|
||||
import random
|
||||
import datetime
|
||||
|
||||
SYSLOG_DATE_FMT = "%b %d %H:%M:%S"
|
||||
ACCESS_LOG_DATE_FMT = "%d/%b/%Y:%H:%M:%S"
|
||||
GENERIC_DATE_FMT = "%Y-%m-%dT%H:%M:%S.%%s"
|
||||
|
||||
TEST_ADDRESSES = [
|
||||
"192.0.2.55",
|
||||
#"192.0.2.123",
|
||||
"192.0.2.33",
|
||||
#"192.0.2.2",
|
||||
]
|
||||
|
||||
TEST_USERNAMES = [
|
||||
"bob@example.com",
|
||||
"-",
|
||||
"-",
|
||||
"-",
|
||||
"-",
|
||||
"-",
|
||||
"-",
|
||||
]
|
||||
|
||||
TEST_METHODS = [
|
||||
"GET",
|
||||
"GET",
|
||||
"GET",
|
||||
"GET",
|
||||
"GET",
|
||||
"GET",
|
||||
"PUT",
|
||||
]
|
||||
|
||||
TEST_URLS = [
|
||||
"/index.html",
|
||||
"/index.html",
|
||||
"/index.html",
|
||||
"/features.html",
|
||||
"/images/compass.jpg",
|
||||
"/obj/1234",
|
||||
"/obj/1235?foo=bar",
|
||||
"/obj/1236?search=demo&start=1",
|
||||
]
|
||||
|
||||
TEST_VERSIONS = [
|
||||
"HTTP/1.0",
|
||||
"HTTP/1.0",
|
||||
"HTTP/1.1",
|
||||
]
|
||||
|
||||
TEST_STATUS = [
|
||||
200,
|
||||
200,
|
||||
200,
|
||||
200,
|
||||
200,
|
||||
200,
|
||||
200,
|
||||
200,
|
||||
200,
|
||||
200,
|
||||
404,
|
||||
500
|
||||
]
|
||||
|
||||
TEST_REFERRERS = [
|
||||
"-",
|
||||
"-",
|
||||
"-",
|
||||
"-",
|
||||
"-",
|
||||
"-",
|
||||
"http://lnav.org/download.html",
|
||||
]
|
||||
|
||||
TEST_AGENTS = [
|
||||
"-",
|
||||
"-",
|
||||
"-",
|
||||
"-",
|
||||
"Apache-HttpClient/4.2.3 (java 1.5)",
|
||||
"Apache-HttpClient/4.2.3 (java 1.5)",
|
||||
"Apache-HttpClient/4.2.3 (java 1.5)",
|
||||
"Apache-HttpClient/4.2.3 (java 1.5)",
|
||||
"Apache-HttpClient/4.2.3 (java 1.5)",
|
||||
]
|
||||
|
||||
def access_log_msgs():
|
||||
while True:
|
||||
yield '%s - %s [%s +0000] "%s %s %s" %s %s "%s" "%s"\n' % (
|
||||
random.choice(TEST_ADDRESSES),
|
||||
random.choice(TEST_USERNAMES),
|
||||
datetime.datetime.utcnow().strftime(ACCESS_LOG_DATE_FMT),
|
||||
random.choice(TEST_METHODS),
|
||||
random.choice(TEST_URLS),
|
||||
random.choice(TEST_VERSIONS),
|
||||
random.choice(TEST_STATUS),
|
||||
random.randint(16, 1024 * 1024),
|
||||
random.choice(TEST_REFERRERS),
|
||||
random.choice(TEST_AGENTS)
|
||||
)
|
||||
|
||||
TEST_PROCS = [
|
||||
"server[123]",
|
||||
"server[123]",
|
||||
"server[123]",
|
||||
"server[121]",
|
||||
"server[124]",
|
||||
"server[123]",
|
||||
"worker[61456]",
|
||||
"worker[61456]",
|
||||
"worker[61457]",
|
||||
]
|
||||
|
||||
TEST_MSGS = [
|
||||
"Handling request %s" % uuid.uuid4(),
|
||||
"Handling request %s" % uuid.uuid4(),
|
||||
"Handling request %s" % uuid.uuid4(),
|
||||
"Successfully started helper",
|
||||
"Reading from device: /dev/hda",
|
||||
"Received packet from %s" % random.choice(TEST_ADDRESSES),
|
||||
"Received packet from %s" % random.choice(TEST_ADDRESSES),
|
||||
"Received packet from %s" % random.choice(TEST_ADDRESSES),
|
||||
]
|
||||
|
||||
def syslog_msgs():
|
||||
while True:
|
||||
yield '%s frontend3 %s: %s\n' % (
|
||||
datetime.datetime.utcnow().strftime(SYSLOG_DATE_FMT),
|
||||
random.choice(TEST_PROCS),
|
||||
random.choice(TEST_MSGS),
|
||||
)
|
||||
|
||||
try:
|
||||
shutil.rmtree("/tmp/demo")
|
||||
os.makedirs("/tmp/demo")
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
FILES = [
|
||||
(open("/tmp/demo/access_log", "w"), access_log_msgs()),
|
||||
(open("/tmp/demo/messages", "w"), syslog_msgs()),
|
||||
]
|
||||
|
||||
while True:
|
||||
for fp, gen in FILES:
|
||||
for i in range(random.randrange(0, 4)):
|
||||
fp.write(gen.next())
|
||||
fp.flush()
|
||||
time.sleep(random.uniform(0.25, 0.75))
|
@ -388,6 +388,10 @@ COMMANDS
|
||||
Enable a inactive 'filter-in' or 'filter-out'
|
||||
expression.
|
||||
|
||||
set-min-log-level <level>
|
||||
Set the minimum level to display in the log view.
|
||||
You can use TAB to view the possible values.
|
||||
|
||||
disable-word-wrap Disable word wrapping in the log and text file views.
|
||||
enable-word-wrap Enable word wrapping in the log and text file views.
|
||||
|
||||
|
@ -531,8 +531,19 @@ public:
|
||||
|
||||
int attrs_for_ident(const char *str, size_t len) const {
|
||||
int index = crc32(1, (const Bytef*)str, len);
|
||||
int retval;
|
||||
|
||||
return this->vc_role_colors[VCR_HIGHLIGHT_START + (abs(index) % HL_COLOR_COUNT)];
|
||||
if (COLORS >= 256) {
|
||||
retval = this->vc_role_colors[
|
||||
VCR_HIGHLIGHT_START + HL_BASIC_COLOR_COUNT * 2 +
|
||||
(abs(index) % (HL_COLOR_COUNT - HL_BASIC_COLOR_COUNT * 2))];
|
||||
}
|
||||
else {
|
||||
retval = this->vc_role_colors[
|
||||
VCR_HIGHLIGHT_START + (abs(index) % HL_COLOR_COUNT)];
|
||||
}
|
||||
|
||||
return retval;
|
||||
};
|
||||
|
||||
int attrs_for_ident(const std::string &str) const {
|
||||
|
Loading…
Reference in New Issue
Block a user