Dear Community,
today my website was under attack for several hours. 2 specific IPs make a tons of "get requests" to a specific page and apache server goes up and down. Now the problem is solved because I put in firewall blacklist these IPs, but I took a lot of time to analyze the apache log to discover what's wrong.
What I would like to do now is make a script to read the apache log (named access.log) and count the same IP who are makeng multiple request. So in other words this is part of the log:
So I would like to count the same IPs and get an output something like:
37.59.55.202 = 4
50.7.167.19 = 3
etc...etc...
So I can recognize in a fast way which is the IP/s to block.
Could someone address me to make a bash script to do that?
AAhh very good, thanks!
But is there a way to filter specific count to show only occurencies greater then "X"?
This because otherwise I'll get tons of output.
ENVIROMENT
Linux: RHEL 6.4
Log Path: /usr/iplanet/servers/https-company/logs
Log Format: user.log.03-15-2015
I have log4j log rotation enabled rotating files on a daily basis.
The rotated logs are NOT compressed & are taking up too much space.
I need a script that will run daily that... (1 Reply)
Hi all,
Below is a script I'm writing and giving me error:
#!/usr/bin/sh
if ; then
echo "Success!"
else
echo "Failure!"
fi
Normally if I do ps -ef|grep dw.sap|wc -l it gives me output of 18. So my script checks if it's greater than 17 it echoes success else failure
... (5 Replies)
Hey everyone,
I have a bunch of lines with values in field 4 that I am interested in.
If these values are between 1 and 3 I want it to count all these values to all be counted together and then have the computer print out
LOW and the number of lines with those values in between 1 and 3,... (2 Replies)
ENVIROMENT
Linux: Fedora Core release 1 (Yarrow)
iPlanet: iPlanet-WebServer-Enterprise/6.0SP1
Log Path: /usr/iplanet/servers/https-company/logs
I have iPlanet log rotation enabled rotating files on a daily basis.
The rotated logs are NOT compressed & are taking up too much space.
I... (7 Replies)
Can you explain what this line of script is doing.
What I have understood is :
-- variable C is the name of a software which is either not installed, so it must be installed or allready installed and then should be update if newer version found
-- branch B="$B $C" is to install the software
--... (4 Replies)
Hi!
I wanted to simplify my bash prompt, so I edited my etc/bashrc file. I thought this was the file that would override any other env files. When I opened it, I saw that the way it was setup was not what my prompt looked like, although I forget exactly what was there. But i edited it the way I... (1 Reply)
Hello,
I have a file like following:
ALB_13554 1 1 1
ALB_13554 1 2 1
ALB_18544 2 0 2
ALB_18544 1 0 1
This is a sample of my file, my real file has 441845 number of fields. What I want to do is to calculate the number of 1 and 2 in each column using AWK, so, the output file looks like... (5 Replies)
Hi
I have a complex script which outputs a text file for loading into a db.
I now need to enhance this script do that I can issue an ‘lp' command
to show the count of the number of records in this file.
Can anybody give me the necessary syntax ? (2 Replies)
Here's a question I received on a test recently. I'm new to Linux/Unix so if this is easy, don't kill me. What scripting or tools could you use to count and sort the number of connections from each internal host? I'd appreciate any feedback and resources.
"The Cisco PIX firewall provides... (5 Replies)