Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement and analyze the region where ip is located in the apache log of Shell scripts

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to achieve and analyze the Shell script apache log in the region", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "how to achieve and analyze the Shell script apache log in the ip area" bar!

Query the components used by the ip address

The code is as follows:

Wget http://rfyiamcool.googlecode.com/files/nali-0.1.tar.gz

Tar zxvf nali-0.1.tar.gz

Cd nali-0.1

. / configure & & make & & make install

The steps are similar to those of nginx, except that the method of getting the ip address in the log is different.

The code is as follows:

#! / bin/bash

# rfyiamcool

IPSUMFILE=access_ip.log

SAVEFILE=ipaddress.txt

Echo-e "IP address\ t\ t Source\ nMurray -" > $SAVEFILE

# log path

LOG_DIR=/usr/local/apache/logs/

For i in $LOG_DIR/*.log

Do

Cat / etc/httpd/logs/access_log | awk'{print $1}'| sort | uniq-c | sort-nr | awk'{print $2}'> > $IPSUMFILE

Done

For i in `cat $IPSUMFILE`

Do

Nali $I > > $SAVEFILE

Done

Finally, cat view

Thank you for your reading, the above is "how to achieve and analyze the Shell script apache log in the ip region" content, after the study of this article, I believe you on how to achieve and analyze the Shell script apache log in the region of this problem has a more profound experience, the specific use of the need for you to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report