From eee041d58738f17f97db4b4302ea77086ff8f5ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20B=C3=BCtow?= Date: Wed, 22 Jan 2020 12:58:26 +0000 Subject: minor formatting fixes --- doc/examples.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'doc/examples.md') diff --git a/doc/examples.md b/doc/examples.md index 78a9caf..959105c 100644 --- a/doc/examples.md +++ b/doc/examples.md @@ -10,7 +10,7 @@ This page demonstrate the basic usage of DTail. Please also see ``dtail --help`` The following example demonstrates how to follow logs of multiple servers at once. The server list is provided as a flat text file. The example filters all logs containing the string ``STAT``. Any other Go compatible regular expression can be used instead of ``STAT``. ```shell -workstation01 ~ % dtail --servers serverlist.txt --files "/var/log/service/*.log" --regex STAT +% dtail --servers serverlist.txt --files "/var/log/service/*.log" --regex STAT ``` ![dtail](dtail.gif "Tail example") @@ -20,7 +20,7 @@ workstation01 ~ % dtail --servers serverlist.txt --files "/var/log/service/*.log To run ad-hoc mapreduce aggregations on newly written log lines you also must add a query. This example follows all remote log lines and prints out every 5 seconds the top 10 servers with most average free memory according to the logs. To run a mapreduce query across log lines written in the past please use the ``dmap`` command instead. ```shell -workstation01 ~ % dtail --servers serverlist.txt \ +% dtail --servers serverlist.txt \ --query 'select avg(memfree), $hostname from MCVMSTATS group by $hostname order by avg(memfree) limit 10 interval 5' \ --files '/var/log/service/*.log' ``` @@ -34,7 +34,7 @@ In order for mapreduce queries to work you have to make sure that your log forma The following example demonstrates how to cat files (display the whole content of the files) of multiple servers at once. The servers are provided as a comma separated list this time. ```shell -workstation01 ~ % dcat --servers serv-011.lan.example.org,serv-012.lan.example.org,serv-013.lan.example.org \ +% dcat --servers serv-011.lan.example.org,serv-012.lan.example.org,serv-013.lan.example.org \ --files /etc/hostname ``` @@ -45,7 +45,7 @@ workstation01 ~ % dcat --servers serv-011.lan.example.org,serv-012.lan.example.o The following example demonstrates how to grep files (display only the lines which match a given regular expression) of multiple servers at once. In this example we look after the swap partition in ``/etc/fstab``. We do that only on the first 20 servers from ``serverlist.txt``. ``dgrep`` is also very useful for searching log files of the past. ```shell -workstation01 ~ % dgrep --servers <(head -n 20 serverlist.txt) \ +% dgrep --servers <(head -n 20 serverlist.txt) \ --files /etc/fstab \ --regex swap ``` @@ -57,7 +57,7 @@ workstation01 ~ % dgrep --servers <(head -n 20 serverlist.txt) \ To run a mapreduce aggregation over logs written in the past the ``dmap`` command can be used. For example the following command aggregates all mapreduce fields of all the logs and calculates the average memory free grouped by day of the month, hour, minute and the server hostname. ``dmap`` will print interim results every few seconds. The final result however will be written to file ``mapreduce.csv``. ```shell -dmap --servers serv-011.lan.example.org,serv-012.lan.example.org,serv-013.lan.example.org,serv-021.lan.example.org,serv-022.lan.example.org,serv-023.lan.example.org \ +% dmap --servers serv-011.lan.example.org,serv-012.lan.example.org,serv-013.lan.example.org,serv-021.lan.example.org,serv-022.lan.example.org,serv-023.lan.example.org \ --query 'select avg(memfree), $day, $hour, $minute, $hostname from MCVMSTATS group by $day, $hour, $minute, $hostname order by avg(memfree) limit 10 outfile mapreduce.csv' \ --files "/var/log/service/*.log" ``` -- cgit v1.2.3