🖥️multitail

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the multitail command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#  ███╗   ███╗██╗   ██╗██╗  ████████╗██╗████████╗ █████╗ ██╗██╗     
#  ████╗ ████║██║   ██║██║  ╚══██╔══╝██║╚══██╔══╝██╔══██╗██║██║     
#  ██╔████╔██║██║   ██║██║     ██║   ██║   ██║   ███████║██║██║     
#  ██║╚██╔╝██║██║   ██║██║     ██║   ██║   ██║   ██╔══██║██║██║     
#  ██║ ╚═╝ ██║╚██████╔╝███████╗██║   ██║   ██║   ██║  ██║██║███████╗
#  ╚═╝     ╚═╝ ╚═════╝ ╚══════╝╚═╝   ╚═╝   ╚═╝   ╚═╝  ╚═╝╚═╝╚══════╝

# https://wiki.natenom.de/linux/verschiedenes/multitail-schemas
# /etc/multitail.conf : Ihr sind die Farbschemas gespeichert und allgemeine Parameter
# .multitailrc : Diese Datei kann man in seinem Homepfad anlegen und eigene Defaults festlegen
# https://lanbugs.de/howtos/linux-tipps-tricks/multitail-mehre-logs-live-betrachten-und-in-farbe/
# https://www.pantz.org/software/multitail/multitailconfig.html
# http://nion.modprobe.de/blog/archives/440-Using-the-ii-irc-client.html

# Mit den Tasten a und d lassen sich Dateien, Programme oder Fenster hinzufügen und entfernen, F1 oder Strg-H bringen die Onlinehilfe auf den Schirm, mit Strg-G gelangt man zurück zur normalen Ansicht. Tippt der Nutzer w, speichert das Programm ein kurzes Shell-Skript, das multitail mit allen aktuellen Einstellungen neu startet.
# By default MultiTail does the same thing as ‘tail -f‘, i.e. view files in a real time. To view/monitor two different files in one window, the basic syntax is:

## 1. How To View 2 Files in Single Window
multitail /var/log/apache2/error.log /var/log/apache2/error.log.1
 
# To scroll through the files, hit ‘b‘ and select the file you want from the list.
# Once, you select the file, it will show you last 100 lines of that selected file, to scroll through use the cursor keys. You can also use ‘gg‘/’G‘ to move to the top/bottom of the scroll window. If you want to view more lines, hit ‘q’ to exit and hit ‘m‘ to enter a new value for the number of lines to view.

## 2. How To View 2 Files in 2 Columns
# The following command will display two different files in 2 columns.
multitail -s 2 /var/log/mysqld.log /var/log/xferlog
 
## 3. How To View Multiple Files in Multiple Columns
# Display 3 files in three columns.
multitail -s 3 /var/log/mysqld.log /var/log/xferlog /var/log/yum.log
 
## 4. Merge/View Multiple Files in Multiple Columns 
# Displays 5 logfiles while merging 2 files in one column and keep 2 files in two columns with only one in the left column.
multitail -s 2 -sn 1,3  /var/log/mysqld.log -I /var/log/xferlog /var/log/monitorix /var/log/ajenti.log /var/log/yum.log
 
## 5. How to View File and Execute a Command
# Shows 1 file while ‘-l‘ option allows command to execute in a window.
multitail /var/log/iptables.log -l "ping server.nixcraft.in"
 
# 6. How to Merge/View Two Files in Different Color 
# Merge 2 logfiles in one window, but give different color to each logfile so that you can easily understand what lines are for what logfile.
multitail -ci green /var/log/yum.log -ci yellow -I /var/log/mysqld.log

# Automatically add new files to a window:
multitail -Q /var/log/myprogram/log-2014*.txt

# Merge 2 logfiles in one window:
multitail /var/log/apache2/access.log -I /var/log/apache2/error.log

# Show 3 logfiles in 2 columns:
multitail -s 2 /var/log/apache2/access.log /var/log/messages /var/log/mail.log

# Show 5 logfiles while merging 2 and put them in 2 columns with only one in the left column:
multitail -s 2 -sn 1,3  /var/log/apache2/access.log -I /var/log/apache2/error.log /var/log/messages \
                            /var/log/mail.log /var/log/syslog

# Merge the output of 2 ping commands while removing "64 bytes received from" from only 1 of them:
multitail -l "ping 192.168.0.1" -ke "64 bytes from" -L "ping 192.168.0.2"

# Show the output of a ping-command and if it displays a timeout, send a message to all users currently logged in
multitail -ex timeout "echo timeout | wall" -l "ping 192.168.0.1"

# In one window show all new TCP connections and their state changes using netstat while in the other window displaying the merged access and error logfiles of apache2
multitail -R 2 -l "netstat -t" /var/log/apache2/access.log -I /var/log/apache2/error.log

# As the previosu example but also copy the output to the file netstat.log
multitail -a netstat.log -R 2 -l "netstat -t tcp" /var/log/apache2/access.log -I /var/log/apache2/error.log

# Show 2 logfiles merged in one window but give each logfile a different color so that you can easily see what lines are for what logfile:
multitail -ci green /var/log/apache2/access.log -ci red -I /var/log/apache2/error.log

# Show 3 rssfeeds merged in one window using rsstail
multitail -cS rsstail -l "rsstail -n 1 -z -l -d -u http://setiathome.berkeley.edu/rss_main.php" \
    	-cS rsstail -L "rsstail -n 1 -z -l -d -u http://www.biglumber.com/index.rss" -cS rsstail \
    	-L "rsstail -n 1 -z -l -u http://kernel.org/kdist/rss.xml"

# Show a Squid (proxy server) logfile while converting timestamps to something readable
multitail -cv squid /var/log/squid/access.log

# Display Q-Mail logging while converting the timestamp into human readable format
multitail -cv qmailtimestr /var/log/qmail/qmail.smtpd.log

# Merge ALL apache2 logfiles (*access_log/*error_log) into one window:
multitail -cS apache2 --mergeall /var/log/apache2/*access_log --no-mergeall -cS apache2_error \
    	--mergeall /var/log/apache2/*error_log --no-mergeall

# Monitor the logfile of an other system:     For this you need to setup a couple of things. MultiTail runs on system A, the logfile on system B.
# In this example we're going to monitor the apache2 logfile. 
	# Add the following to /etc/services:
    apache2log       20000/tcp
    
	# Add this to /etc/inetd.conf:
    apache2log stream tcp nowait root /usr/local/sbin/tail_apache2_log /usr/local/sbin/tail_apache2_log

    # and create the file /usr/local/sbin/tail_apache2_log with the following content:

    #!/bin/sh
    /usr/bin/tail -f /var/log/apache2/access.log

	# make sure that you don't forget to make that script executable (chmod +x filename).
	# Then on host A start MultiTail like this:
multitail -cS apache2 -l "telnet B 20000"

	# Please note that logfiles go in plaintext across the network. You may also need to adjust the files /etc/hosts.[allow|deny] on host B to only allow host A to connect.

# Monitoring Tomcat
multitail -cS apache2 -cS log4j "${TOMCAT_HOME}/logs/catalina.out"

#First, a notification can be generated when something special is detected (via a regular expression) in a log file. In the following example, MultiTail will follow the authentication log file and generate an e-mail alert when a failed SSH login occurred:

# The following example will tag blocked packets by a pf (packet filter) firewall on OpenBSD:
multitail -ex "sshd.*Failed password for invalid user" \
                       "echo SSH breaking attempt detected | \
                       mail -s Alert [email protected]" \
                 -i /var/log/authlog"

# The fifth field (“accept” or “block”) and will be displayed in different colors when passing from one value to the other. Combined with the screen utility, a single SSH session to a server is enough to build powerful dashboards
multitail -cf 5 " " -l "tcpdump -n -e -ttt -i pflog0"

# You can also use MultiTail to view logfiles on other hosts! use authentication via keys or use "ssh-agent": then you only once have to enter your passphrase (so login once to that host manually, and then start MultiTail)
multitail -l "ssh -t username@host tail -f file"

# tail 2x logs + command
multitail messages syslog -R 2 -l "lsof -i"
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░