Monitor multiple logs in a single shell with MultiTail

Posted In System - By Tum. On Saturday, May 25th, 2013 With 0 Comments

tail เป็นคำสั่งที่นิยมใช้งานกันอย่างแพร่หลายและสามารถให้ผู้ใช้งานสามารถดู log แบบ real time ได้อย่างง่ายดาย (tail -f /var/log/logfile) และในบทความนี้จะนำเสนอโปรแกรมอีกตัวที่ทำหน้าที่เหมือน tail แต่สามารถสร้างหน้าต่างได้หลายๆ หน้าต่างในหน้า console ซึ่งจะช่วยอำนวยความสะดวกให้กับผู้ที่ต้องการใช้งาน tail เพื่อดู log file หลายๆไฟล์พร้อมๆกัน เพราะไม่ต้องเปิดหน้าต่าง console หลายหน้า ตามตัวอย่างภาพด้านล่าง

multitail-linux-tool

นอกจากนี้ยังสามารถรันคำสั่งพร้อมกับดู log ไปพร้อมกันได้อีกด้วย ตามตัวอย่างภาพด้านล่าง

multitail-log-and-command

วิธีติดตั้ง MultiTail บน CentOS
รันคำสั่งด้านล่างเพื่อติดตั้ง multitail

วิธีใช้งาน multitail

  • ดู log file มากกว่า 1 log file แบบ 1 column
    ตัวอย่างเช่นต้องการดู log /var/log/named.log /var/log/dmesg และ /var/log/anaconda.log ให้รันคำสั่ง

    ตัวอย่างผลลัพธ์
    multitail-linux-tool

  • ดู log file มากกว่า 1 log file แบบ 2 column (หรือมากกว่า)
    ตัวอย่างเช่นต้องการดู log /var/log/named.log /var/log/dmesg /var/log/anaconda.log และ /var/log/zarafa/server.log แบบ 2 column ให้รันคำสั่ง 

    *ถ้าหากต้องการมากกว่า 2 column ก็สามารถแก้ไขได้ที่ option -s

    ตัวอย่างผลลัพธ์
    multitail-linux-tool-with-multi-column

  • ดู log file และให้รันคำสั่งพร้อมกัน
    ตัวอย่างเช่นต้องการดู log /var/log/dmesg พร้อมรันคำสั่ง ping ไปพร้อมๆกัน

    * ใช้ -l option เพื่อให้ multitail รันคำสั่งที่ต้องการ

    ตัวอย่างผลลัพธ์
    multitail-log-and-command

ถ้าหากต้องการความสามารถอื่นเพิ่มเติมสามารถอ่านได้จาก manual ของ multitail นะครับ :)

Tags: ,

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

*