So I need to write a script that can parse our logs and give me the amount of daily activity per user on our website. Unfortunately I'm still learning the very basics so please bear with me :eek:. Below is an example snippet from a log to give you a basic idea of what each entry in the log basically looks like (the important parts I want extracted bolded and are basically just the date and username):
So when somebody is on our site and performs activity, clicking through different pages, etc. an entry like above is written to the log for each bit of activity. In each log there can be several different days depending upon the activity (logs rotate based on size).
So far I've got this:
This gives me a list of two colums, with the number of instances (and hence user activity) paired with the username. Now I need to associate these with the date so that for any given day it will output the username and activity and day/date, and output that to .csv file. I'm open to any method really, I "think" it shouldn't be too difficult to modify what I have already but then again I'm new to this and not really sure how to do it right
Code:
blahblahblahblah- 05-26@09:31:26:235 INFO (blahblahblahblah) - myorganization.api.ApiHandler-0>getID(blahblahblahblah:"","user_info":{"username":"joe@somecompany.com","orgid":"blahblahblahblah"
So when somebody is on our site and performs activity, clicking through different pages, etc. an entry like above is written to the log for each bit of activity. In each log there can be several different days depending upon the activity (logs rotate based on size).
So far I've got this:
Code:
awk -F"\"username\":\"" '{ print $2 }' logs/mycompany.log | awk -F"\"" '{ print $1 }' | sort | uniq -c