เปิดรับสมัครสมาชิก webboard ตามปกติแล้วครับ

ผู้เขียน หัวข้อ: เราสามารถทำให้ squid เก็บ logfile ทำแบบที่ proxy+ ได้ไหมคับ  (อ่าน 9029 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

supot87

  • บุคคลทั่วไป
สวัสดีคับ เราสารถทำให้ squid เก็บ logfile แบบที่ proxy+ ทำได้ไหมคับ ผมใฃ้ squid2Stable12SiamcafeEdtion อยู่เข้าไปดู logfile มันจะบอกแต่ที่ไปเว็ปที่ไหยมา แต่ไม่บอกว่าเครื่องไหนต่อคับ ขอรบกวนผู้รู้หน่อยนะคับ

ออฟไลน์ mrkai999

  • สัมมนาทำ Server ! พี่น้องร้านเน็ต ร้านเกม ร้านคอม อยากทำเป็นลงทะเีบียนด่วน...
  • รุ่นTHE
  • *******
  • กระทู้: 588
  • Reputation: 2
    • mrkai999
Re: เราสามารถทำให้ squid เก็บ logfile ทำแบบที่ proxy+ ได้ไหมคับ
« ตอบกลับ #1 เมื่อ: สิงหาคม 09, 2007, 11:20:35 pm »
ให้ท่านไป สมัครเป็นสมาชิก สภาฯ www.icct-th.com นะครับ ผมได้ประสานให้ทาง SIPA จัดทำให้อยู่ครับ

http://ossc.in.th/forum/index.php?topic=577.0

โครงการรักความเป็นไท ใช้ซอฟต์แวร์ถูกกฎหมาย ช่วยชาติประหยัด ช่วยลูกหลาน
http://www.facebook.com/groups/netcafefreedom/

kkd370579

  • บุคคลทั่วไป
Re: เราสามารถทำให้ squid เก็บ logfile ทำแบบที่ proxy+ ได้ไหมคับ
« ตอบกลับ #2 เมื่อ: สิงหาคม 09, 2007, 11:25:18 pm »
ขออนุญาติเอาตัวของ sarg มาให้ดู ทำได้เหมือนกัน สำหรับคนที่ใช้ linux นะ  :c_laugh: :D

http://demonpic4u.com//images/65068log.JPG

http://demonpic4u.com//images/24254log1.JPG

http://demonpic4u.com//images/69686log2.JPG

ออฟไลน์ country007

  • นักเรียนประถม
  • ****
  • กระทู้: 72
  • Reputation: 0
Re: เราสามารถทำให้ squid เก็บ logfile ทำแบบที่ proxy+ ได้ไหมคับ
« ตอบกลับ #3 เมื่อ: สิงหาคม 10, 2007, 03:24:51 am »
แล้ว logfile ของ squidnt 2.6 มีบ้างหรือเปล่าครับ
Signature cleanned by Admin

ออฟไลน์ dexster1

  • ผ่านการทดสอบเลื่อนชั้น
  • **
  • กระทู้: 29
  • Reputation: 0
Re: เราสามารถทำให้ squid เก็บ logfile ทำแบบที่ proxy+ ได้ไหมคับ
« ตอบกลับ #4 เมื่อ: กุมภาพันธ์ 20, 2008, 05:41:26 am »
กำลังค้นหาเหมือนกันครับว่าจะทำอย่างไร
รบกวนท่านผู้รู้ช่วยแนะนำด้วยครับ ผมใช้SquidNTv4_2FastEdtionBYSiamcafe.exe
อยากจะทำเก็บ log file เพื่อเอาไว้ให้เจ้าหน้าที่ตรวจสอบ
Signature cleanned by Admin

nepweb

  • บุคคลทั่วไป
Re: เราสามารถทำให้ squid เก็บ logfile ทำแบบที่ proxy+ ได้ไหมคับ
« ตอบกลับ #5 เมื่อ: สิงหาคม 24, 2008, 06:03:00 am »
ขออนุญาติเสริมครับ..
Sarg ที่ใช้กับ Linux มี distribute ให้ใช้งานได้หลาย OS ครับ สำหรับ Windows เองก็ได้รวมอยู่ในนั้นด้วย

Binaries:
--------------------
Gentoo packages by  Peter Volkov 
RedHat & Fedora packages by  Dag Wieers 
RedHat packages by  Sergei Dushenkov 
Debian packages by Luigi Gangitano
Suse packages by Victor Hugo dos Santos
Slackware packages by Renato Leon
OpenBSD packages by Douglas Santos
FreeBSD packages
E-Smith packages by Hugues Michel
OS/2 packages by Alex Samorukov
Mac OS X packages by Marcelo E Redoschi
Windows packages by Joao Alves Neto

ออฟไลน์ pakoung

  • นักเรียนประถม
  • ****
  • กระทู้: 51
  • Reputation: 0
Re: เราสามารถทำให้ squid เก็บ logfile ทำแบบที่ proxy+ ได้ไหมคับ
« ตอบกลับ #6 เมื่อ: สิงหาคม 24, 2008, 07:54:38 am »
สามารถทำได้ครับ  สำหรับ 2.6 เท่านั้น ส่วน 2.5 ไม่มีฟังค์ชั่นนี้  ต้องรอกูรู อย่าง พี่บอมบ์มาแกะให้แล้วกัน เพราะเค้าเล่นมันทุกอญูขุมขน Squid แล้ว
เข้าเรื่องนะ การทำวิธีของผมคือการแก้ไฟล์ Squid.conf นะครับ
ก่อนแก้ ไฟล์ที่เก้บ Log ไว้ใน Asscce.Log  จะมีหน้าตาแบบนี้ครับ

1218336956.294    263 192.168.108.19 TCP_MISS/200 10311 GET http://upload.sodazaa.com/files/nzrzygtwkwm15leqmyjg.jpg - DIRECT/210.1.51.8 image/jpeg
1218336956.302    272 192.168.108.19 TCP_MISS/200 12402 GET http://upload.sodazaa.com/files/jttlmfgmzkyjdzjznjmn.jpg - DIRECT/210.1.51.8 image/jpeg
1218336956.320    290 192.168.108.19 TCP_MISS/200 16542 GET http://upload.sodazaa.com/files/nm5m0mjjzmyhmjjoijjt.jpg - DIRECT/210.1.51.8 image/jpeg
1218336956.343    392 192.168.108.19 TCP_MISS/200 18682 GET http://upload.sodazaa.com/files/uevjjyg0nmwmzfuztm4n.jpg - DIRECT/210.1.51.8 image/jpeg
1218336956.619    558 192.168.108.19 TCP_REFRESH_HIT/200 12876 GET http://www.savepix.net/fp/dsmi_01bb7635ec.gif - DIRECT/67.205.15.32 image/gif

จากที่ดูสังเกตุว่ามันสามารถระบุเวปปลายทางได้แล้ว ว่าออกไปเวปไหนมาบ้าง สิ่งที่ยังขาด คือ วันที่ เวลา ซึ่งจริงๆแล้วมันมีระบุไว้แล้วคือ
1218336956.619  แต่มันเป็นลักษณะที่ดูไม่เข้าใจ เราจึงมา ปรับปรุงดังนี้

โดยทำการเพิ่ม

logformat common %{%Y-%m-%d %H:%M:%S}tl %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
cache_access_log  /var/log/squid/access.log common

แทนที่
cache_access_log  /var/log/squid/access.log

ลงในไฟล์ /etc/squid/squid.conf

เสร็จแล้วก็ restartsquit

ก็จะได้รูปแบบใหม่ดังนี้ครับ

2008-08-10 10:03:18    104 192.168.108.13 TCP_MISS/200 335 GET http://patch.sf.in.th/version.ini - DIRECT/61.90.203.90 application/octet-stream
2008-08-10 10:03:18    602 192.168.108.19 TCP_MISS/200 5882 GET http://pagead2.googlesyndication.com/pagead/ads? - DIRECT/209.85.143.164 text/html
2008-08-10 10:03:18    123 192.168.108.19 TCP_HIT/200 1485 GET http://www.cmprice.com/images/icon.ico - DIRECT/202.151.178.64 image/x-icon
2008-08-10 10:03:21    112 192.168.108.18 TCP_REFRESH_HIT/304 265 GET http://widget-ad.slide.com/widgets/shim7.swf - DIRECT/60.254.131.86 application/x-shockwave-flash
2008-08-10 10:03:22     50 192.168.108.19 TCP_HIT/200 465 GET http://www.moohin.com/trips/lao/sabaidee/ - NONE/- text/html
2008-08-10 10:03:22    132 192.168.108.13 TCP_MISS/200 6019 GET http://nprotect.sf.in.th/nProtect/GameGuard/RealServer/update.cfg? - DIRECT/61.90.203.4 config
2008-08-10 10:03:22      9 192.168.108.19 TCP_HIT/200 1774 GET http://www.moohin.com/favicon.ico - NONE/- image/x-icon
2008-08-10 10:03:23     81 192.168.108.19 TCP_MISS/302 581 GET http://www.onlinemediathailand.com/url-work.php - DIRECT/61.47.7.228 text/html
2008-08-10 10:03:23     97 192.168.108.19 TCP_MISS/302 503 GET http://www.moohin.com/cgi-bin/countlink.cgi? - DIRECT/61.47.10.37 text/html
2008-08-10 10:03:23     60 192.168.108.19 TCP_MISS/302 461 GET http://www.moohin.com/cgi-bin/go.cgi? - DIRECT/61.47.10.37 text/html
2008-08-10 10:03:24   1051 192.168.108.19 TCP_MISS/200 7756 GET http://www.thisisforyou.info/ - DIRECT/65.181.130.32 text/html
2008-08-10 10:03:24    961 192.168.108.19 TCP_CLIENT_REFRESH_MISS/200 5820 GET http://www.thisisforyou.info/images/logo1.jpg - DIRECT/65.181.130.32 image/jpeg

ตอนนี้ก็ครบแล้วครับ  วัน/เดือน/ปี เวลา แล้วก็หมายเลขไอพี เครื่องที่ใช้งาน และ ระบุว่าไปเวปไหนมาบ้าง ในช่วงเวลานั้นๆ ที่เหลือก็หาสมุด ไว้จด ชื่อ-นามสกุล เวลาที่เข้าใช้บริการ แล้วก็ เครื่องที่นั่ง หรือหากใครใช้โปรแกรม คิดเงิน ก็ประยุกต์ใช้ แทนสมุดจดก็ได้ จบแล้วง่ายมั๊ยครับ หวังว่าคงมีประโยชน์กับเพื่อนๆบ้างนะครับ

เกือบลืม cache_access_log  /var/log/squid/access.log common ตรงนี้ ถ้าคุณลง Squid ไว้ต้องไหนก็ต้องแก้มันให้ตรงกันด้วยนะครับ ลิงค์ไปให้ถึง Access.Log

เครดิต เวป หาดใหญ่อินเตอร์เน็ต และ www.icct-th.com ครับผม

ปล.จริงๆแล้วร้านเกมส์ไม่ต้องเก็บ Log File ครับ แต่มีเอาไว้กันหมาก็ดีครับ เผื่อหมามาแทะๆก็โยนให้มานดูๆ
Signature cleanned by Admin

nepweb

  • บุคคลทั่วไป
Re: เราสามารถทำให้ squid เก็บ logfile ทำแบบที่ proxy+ ได้ไหมคับ
« ตอบกลับ #7 เมื่อ: สิงหาคม 24, 2008, 08:10:28 am »
ปล.จริงๆแล้วร้านเกมส์ไม่ต้องเก็บ Log File ครับ แต่มีเอาไว้กันหมาก็ดีครับ เผื่อหมามาแทะๆก็โยนให้มานดูๆ

ถูกใจ ปล.ท่าน pakoung มากมายครับ 555+ :laugh:

ออฟไลน์ mrkai999

  • สัมมนาทำ Server ! พี่น้องร้านเน็ต ร้านเกม ร้านคอม อยากทำเป็นลงทะเีบียนด่วน...
  • รุ่นTHE
  • *******
  • กระทู้: 588
  • Reputation: 2
    • mrkai999
Re: เราสามารถทำให้ squid เก็บ logfile ทำแบบที่ proxy+ ได้ไหมคับ
« ตอบกลับ #8 เมื่อ: สิงหาคม 24, 2008, 08:42:40 am »
ก็ถูกนะครับ ทุกโปรแกรมเก็บได้หมด

แต่ปัญหาใหญ่ที่สุด

ตำรวจยังไม่บอกวิธีการ หรือ ต้องการ format ไหน จาก logfile เลย

เคยถามหลายครั้ง ....................................... ไม่รู้เหมือนกัน  ???
http://ossc.in.th/forum/index.php?topic=577.0

โครงการรักความเป็นไท ใช้ซอฟต์แวร์ถูกกฎหมาย ช่วยชาติประหยัด ช่วยลูกหลาน
http://www.facebook.com/groups/netcafefreedom/

ออฟไลน์ modem

  • ปี 1 เทอม 2
  • ***
  • กระทู้: 17
  • Reputation: 0
Re: เราสามารถทำให้ squid เก็บ logfile ทำแบบที่ proxy+ ได้ไหมคับ
« ตอบกลับ #9 เมื่อ: สิงหาคม 30, 2008, 08:45:34 am »
สามารถทำได้ครับ  สำหรับ 2.6 เท่านั้น ส่วน 2.5 ไม่มีฟังค์ชั่นนี้ 
logformat common %{%Y-%m-%d %H:%M:%S}tl %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
cache_access_log  /var/log/squid/access.log common

แทนที่
cache_access_log  /var/log/squid/access.log

ลงในไฟล์ /etc/squid/squid.conf
เสร็จแล้วก็ restartsquit

ขอเพื่มเติมให้ครับ
สำหรับ squid 2.5 ให้ใส่ emulate_httpd_log on ใน squid.conf
ไว้บน logformat common %{%Y-%m-%d %H:%M:%S}tl %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
ก็จะได้

emulate_httpd_log on
logformat common %{%Y-%m-%d %H:%M:%S}tl %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
cache_access_log  /var/log/squid/access.log common

แล้วก็ restart squid
พอ restart มันจะแจ้ง error บรรทัด logformat ไม่ต้องสนใจครับ แล้วก็ squid ok

ลองเข้าไปดูใน access.log บรรทัดท้ายๆ ถ้ามีการเข้าเวปก็จำบันทึกเป็นแบบท่านข้างบนเหมือนกันครับ
Signature cleanned by Admin

cartoonlove

  • บุคคลทั่วไป
Re: เราสามารถทำให้ squid เก็บ logfile ทำแบบที่ proxy+ ได้ไหมคับ
« ตอบกลับ #10 เมื่อ: กันยายน 03, 2008, 11:52:01 pm »
แนะนำ SARG งับ ดีมากๆๆ มีอีกตัวได้ยินมาว่าใช้ได้เหมือนกัน แต่ผมไม่เคยใช้ ใช้แต่ SARG  อีกตัวคือ สะแน อ่ะคับ เขียนไม่ถูก หุหุ

LOTK

  • บุคคลทั่วไป
Re: เราสามารถทำให้ squid เก็บ logfile ทำแบบที่ proxy+ ได้ไหมคับ
« ตอบกลับ #11 เมื่อ: ตุลาคม 26, 2009, 09:24:32 am »
squidnt 2.6
กำหนดรูปแบบ วัน เวลา แบบ ปกติ
logformat common %{%d-%m-%Y %H:%M:%S}tl %6tr %>a %Ss/%03Hs % #cache_access_log /var/log/squid/access.log common
cache_access_log d:/var/logs/access.log common
referer_log d:/var/logs/http.log

squidnt 2.5
ใน squid.conf
เพิ่ม บรรทัด ดังนี้ ก่อนคำสั่งเก็บ access.log
emulate_httpd_log on

การทำ squidnt rotate ดังนี้
ชื่อ batfile "squid-2.5-log-rotate.bat"

@echo off

REM
REM Squid Log Rotation Script by PaperCut Software Pty Ltd
REM


REM The location of the squid log files กำหนดให้เหมือนกับตำแหน่งเก็บ logfile ใน squid.conf

SET SQUID_LOG_PATH=f:\logs

REM Stop the squid service
net stop squidnt

FOR /F "tokens=1-4 delims=/, " %%i in ('date /t') do set YYYYMMDD=%%l-%%k-%%j

REM Rename the log file
ren "%SQUID_LOG_PATH%\access.log" "access-%YYYYMMDD%.log"
ren "%SQUID_LOG_PATH%\http.log" "http-%YYYYMMDD%.log"

REM Restart the squid service
net start squidnt


สำหรับ squidnt 2.6
ชื่อ batfile "squid-2.6-log-rotate.bat"

@echo off

REM
REM Squid Log Rotation Script by PaperCut Software Pty Ltd
REM


REM The location of the squid log files
SET SQUID_LOG_PATH=C:\squid\var\logs

REM Stop the squid service
net stop squid

FOR /F "tokens=1-4 delims=/, " %%i in ('date /t') do set YYYYMMDD=%%l-%%k-%%j

REM Rename the log file
ren "%SQUID_LOG_PATH%\access.log" "access-%YYYYMMDD%.log"

REM Restart the squid service
net start squid

รูปแบบที่ได้ ตัวอย่างตั้งเวลา เก็บทุกเที่ยงคืน


(รูปภาพlog1)


เมื่อต้องการส่งไปยังเครื่องรวม log files
REM Rename the log file
ren "%SQUID_LOG_PATH%\access.log" "access-%YYYYMMDD%.log"
เพิ่มบรรทัด เพื่อตั้งชื่อเครื่องให้ติดไปด้วย
ren "%SQUID_LOG_PATH%\access-%YYYYMMDD%.log" "proxy1_access-%YYYYMMDD%.log"


ส่งไปรวมยังเครื่อง รวม log files แชร์ โฟเดอร์ชื่อ data ในเครื่อง 172.16.0.160 (ตัวอย่าง)
REM Copy to network ip 172.16.0.160
copy "%SQUID_LOG_PATH%\proxy1_access-%YYYYMMDD%.log" \172.16.0.160\data
หรือ ใช้ vb ส่งผ่าน shell ก็ได้ รูปแบบที่ได้


(รูปภาพ log2)


โดย ครูสมคิด มีมะจำ e-mail :[email protected]