Jump to content

Recommended Posts

Posted

добрый день. решил отказаться от SARG и попробовать работать с логами squid через mysql. Раскурил такой способ:

#!/bin/bash

cp /www/logs/squid/access.log /tmp/squidforparse.log 
>/www/logs/squid/access.log
awk '{print "INSERT INTO squid (ip,bytes,link,trans,time) VALUES(\""$3"\","$5",\""$7"\",\""$9"\",from_unixtime("$1"));"};' < /tmp/squidforparse.log | mysql -D traffics -u root --password=my_sql_passwd
rm -f /tmp/squidforparse.log

где $7 - URL страницы

Помогите выделить имя сервера из URL.

Может у кого есть примеры парсинга логов squd в mysql, буду безмерно благодарен.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...