Forum Discussion

Dark_Knight666's avatar
Dark_Knight666
Icon for Bronze III rankBronze III
22 days ago

Web Log Analysis: Ep.5 – Searching Web Server Logs using Linux CLI

Hello,

I was wondering if I could please get me help in the right direction. 

So I'm on Q3 for this lab and a little confused as to how to combine my commands in order to answer the question? 

So the question itself is - Using the access logs, how many requests were received by the server from unique IP addresses?

I would like to assume that I would always start with - cat access.log* |  - but not sure after the pipe what commands to put next? I have tried uniq -c - but to no avail.

Many thanks. 

 

2 Replies

  • Well, the idea of the lab seems to be: Use "cut" to extract the IP address from the logs, and then count the unique values.
    Another tool that you'll love or hate is awk. One of the most basic commands is

    awk '{print $1}' 

    Complete example:

    echo "a b c" | awk '{print $2}'
    b

    It is much more versatile than cut, but not needed for this lab. Yet, I used it.