Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shell scriping for log management 1

Status
Not open for further replies.

Kefx

ISP
May 21, 2004
3
US
Hello,
Im working with a ISP and this company has a FreeBSD box that holds various dial-up logs. Lets say one of these is /var/log/connections. Keep in mind the information looks kind of like a syslog file in which it goes:
Month Day Time info

This file gets very huge and we would like to have a way to sort it by month, so if its the end of april it will dump all of the same month info into " connections.april ". Any ideas on a way to script this? I figure crontab will be involved.

Thanks.
 
Can you post some example lines ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I don't have an exact one since its the weekend and but it would look something like:

May 21 19:31:52 deviod [portmaster]: connection failed from 192.168.1.1

Hope this is what you mean.
 
Something like this ?
grep -i "^`date +%b`" /var/log/connections >/var/log/connections.`date +%B`

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top