Several commands for viewing processes and logs

Source: Internet
Author: User
Several commands for viewing processes and logs-Linux Enterprise Application-Linux server application information. The following is a detailed description. When I configured nagios today, I found 1272 processes, which scared me to death. Let's take a look at it on the server.

# Ps-ef | wc-l
1271

There are so many.

Check again
# Ps-ef | grep httpd | awk '{print $ NF}' | sort-nr | uniq-c
1201 start --- this is abnormal

It's really scary. Let's take a look at it. The apache on this machine is useless. Shut it down directly.

The process returns to normal. Can I modify the apache configuration file to solve this problem?

Because squid transparent proxy is used in the company's Intranet, the sarg used for log processing is viewed in a browser, but not in the command line.

So I went on to ask.

The most stupid method I use
Cat/home/squid2/var/logs/access. log | grep 'IP'> **. txt
Tail **. txt

You can find the most recent access record of this IP address.

Question 1: How can I use a single command to implement it?
Question 2: How can I display a log in a format that does not display time?

Hey. IORI command.

# Cat/home/squid2/var/logs/access. log | awk '{$1 = strftime ("% c", $1)} {print $0}' | grep '10. 0.0.252 '| tail-n1

Mon Apr 21 12:32:07 2008 377 10.0.0.252 TCP_MISS/200 2891 GET http:-/favicon. ico-DIRECT/220.181.38.78 image/x-icon

The result is also displayed.
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.