Server-side view of log shell script

Source: Internet
Author: User

The server side looks at the log shell script (where path1 and path2 are replaced with the path feature name, and the path followed by "Tail-f" is replaced with the log file path for the path feature name):

#! /bin/SH#Check log.Echo "which path (G/API):"Read PathEcho "Keyword:"Read keywordif["$path"=='g']; Then        Tail-F. /project/g.caipiao.163. Com/log/duobao.log |grep-I."$keyword"elif["$path"=='API']; Then        Tail-F. /project/api.g.caipiao.163. Com/log/duobao.log |grep-I."$keyword"fi

1. Touch checklog.sh file in the current directory after entering the server;

2. Enter "I", copy the above content right-click paste;

3. Press ESC to exit edit mode and enter ": Wq" to save the changes;

4. Enter "Sh checklog.sh" to execute the script;

5. Enter the path feature name and keyword to continuously filter the log.

Server-side view of log shell script

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.