Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello my name is Jen Garcia I am very new to Linux and I’m currently working on a log file project and I’m totally lost and have no idea where to begin
Here is the sample log file format
192.168.28.168 user143 [08/May/2010:09:52:52] "GET /NoAuth/js/scriptaculous/scriptaculous.js?load=effects,controls HTTP/1.1" "http://www.example.com/index.html" "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0"
192.168.28.168 user147 [08/May/2010:09:52:52] "GET /NoAuth/js/prototype/prototype.js HTTP/1.1" "http://www.example.com/index.html" "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0"
192.168.28.168 user174 [08/May/2010:09:52:52] "GET /NoAuth/js/ahah.js HTTP/1.1" "http://www.example.com/index.html" "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0"
Top 5 most used resources:
10000 /NoAuth/js/util.js
10000 /NoAuth/js/titlebox-state.js
10000 /NoAuth/js/ahah.js
10000 /NoAuth/js/prototype/prototype.js
10000 /NoAuth/js/scriptaculous/scriptaculous.js?load=effects,controls
I have #!/bin/bash since I was instructed not to change anything. Date the range of the log. from oldest to newest using head, tail, cut. Any suggestions?
You could maybe include some more information on what exactly it is you were asked to do?
As suggested above there are many scripts already written for parsing these types of logs, but your teacher may have asked you to write something based on what you have been learning.
If it is the latter you would have to indicate this and what it is you have learned so your question may be better addressed.
If the question is simply put as here is data and here is the desired output, which can be produced by any means necessary, then go down the road of finding tools already designed for the task.
No need to reinvent the wheel, unless you are learning how they attach to cars and help you to drive
You could maybe include some more information on what exactly it is you were asked to do?
As suggested above there are many scripts already written for parsing these types of logs, but your teacher may have asked you to write something based on what you have been learning.
If it is the latter you would have to indicate this and what it is you have learned so your question may be better addressed.
If the question is simply put as here is data and here is the desired output, which can be produced by any means necessary, then go down the road of finding tools already designed for the task.
No need to reinvent the wheel, unless you are learning how they attach to cars and help you to drive
I have to write a bash script analyzes the access logs of web servers which indicates web statistics
Firstly, Habitual is not intending to be "mean", but rather point out that you do indeed have what appears to be a co-student asking very similar questions.
This would make it prudent that you look at what has already been written as it may assist you
As to your extra information ... so a bash script to parse a log file and then deliver the required statistics ... if I have understood you correctly.
So as you will have learned many things in your course already, you should be able to show what basic things you have already done.
For instance, how would you go about reading from a file and storing the data into worthwhile variables?
Your current shown data for the log file appears reduced from that of the other thread, so show all data that would appear on a line from the log file.
Firstly, Habitual is not intending to be "mean", but rather point out that you do indeed have what appears to be a co-student asking very similar questions.
This would make it prudent that you look at what has already been written as it may assist you
As to your extra information ... so a bash script to parse a log file and then deliver the required statistics ... if I have understood you correctly.
So as you will have learned many things in your course already, you should be able to show what basic things you have already done.
For instance, how would you go about reading from a file and storing the data into worthwhile variables?
Your current shown data for the log file appears reduced from that of the other thread, so show all data that would appear on a line from the log file.
Start simple and build the script by pieces.
Thanks for your advice, how would you pm a user on here?
Ok, so start and write the small pieces you know and slowly put your script together. When stuck, come back and show what you have written and what the current hurdle is.
You have to remember that your first statement was:
Quote:
Hello my name is Jen Garcia I am very new to Linux and I’m currently working on a log file project and I’m totally lost and have no idea where to begin
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.