ข่าว: ข่าวประกาศ

  • 18 พฤษภาคม 2024, 14:10:07

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น

ผู้เขียน หัวข้อ: วิธีเพิ่ม sarg เข้าไปอย่างละเอียดในแผ่นชุด upogate  (อ่าน 12851 ครั้ง)

soulgi

  • Customer Lv.1
  • Full Member
  • ***
  • กระทู้: 107
    • ดูรายละเอียด
    • อีเมล์
พอดี webmaster คงเหนื่อยๆช่วงนี้นะคับคงมีหลายๆคนไปถาม เช่นเดียวกันกับผมนะคับ
เลยเขียนมาให้ทุกคนลองทำดูนะคับ

putty เข้าไปใน root user
apt-get update
apt-get install sarg

 pico /etc/squid/squid.conf      \\ คำสั่งเพื่อเข้าไปแก้ไขไฟล์\\
เพิ่ม cache_access_log  /var/log/squid/sarg.log
หลังชุดคำสั่ง
logformat common %{%Y-%m-%d %H:%M:%S}tl %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh$
cache_access_log  /var/log/squid/access.log common      \\ อันนี้คือโปรแกรม log ของเดิมจากแผ่นซื่งทำการแก้ไขแล้ว\\
cache_access_log  /var/log/squid/sarg.logไฟล์          \\ log จะถูกนำไปเก็บไฟล์  /var/log/squid/sarg.log\\
กด ctrl +x แล้วกด y เพื่อทำการ save
touch /var/log/squid/sarg.log         \\พิมใน command\\
/etc/init.d/squid restart                \\ พิมใน command เพื่อทำการ restart service squid \\

เสร็จแล้วให้เข้าไปหา webmin
https://ip-server:10000
ใส่ user password
กด Refresh Modules        \\ ทำการ reload modu ต่างๆ

ไปที่ Server >> Squid Report Generator >> Log Source and Report Destination
เลือก Other file แล้วใส่ /var/log/squid/sarg.log
Mail sending command ให้เลือก Default (mailx)
แล้วกด save
แล้วไปที่ Scheduled Report Generation
Scheduled report enabled?        \\ ให้เลือก Yes, at times selected below .. 
Simple schedule ..          \\ ให้เลือก Daily (at midnight)
save
เลือก Generate Report Now
แค่นี้ก็เสร็จแล้วท่านก็เข้าไปดู sarg ได้ที่
http://ip-server/squid-reports/

ขอบคุณคับ
ใครที่แก้ไข /etc/init.d/tableroute.sh
เป็น 1 wan game 2 wan internet balance แบ่งให้ผมด้วยนะคับ ประมาณงงนะคับ ไฟล์อื่นแก้ไขหมดแล้วเหลือตัวเดียวนี้ละคับ T-T


« แก้ไขครั้งสุดท้าย: 27 สิงหาคม 2008, 17:00:43 โดย soulgi »

admin

  • Administrator
  • Hero Member
  • *****
  • กระทู้: 3820
    • ดูรายละเอียด
    • อีเมล์
Re: วิธีเพิ่ม sarg เข้าไปอย่างละเอียดในแผ่นชุด upogate
« ตอบกลับ #1 เมื่อ: 27 สิงหาคม 2008, 16:43:06 »
มาช่วยเสริมให้นะครับ

ในการติดตั้ง Sarg เพื่อวิเคราะห์ Squid Log file (แต่ยังขาดการค้นหา เหมือน Plawan อยู่)

คำสั่งแรกที่ต้องใช้คือ

apt-get update

จะได้ผลลัพธ์ ดังนี้ (... หมายถึง ย่อผลลัพธ์ไว้นะครับ)

โค๊ด: [Select]
root@MultiWAN:~# apt-get update
Get:1 http://mirror1.ku.ac.th gutsy Release.gpg [191B]
Ign http://mirror1.ku.ac.th gutsy/main Translation-en_US
Ign http://mirror1.ku.ac.th gutsy/restricted Translation-en_US
.....
.....
.....
Get:10 http://mirror1.ku.ac.th gutsy-security/universe Sources [12.2kB]
Fetched 273kB in 2s (93.6kB/s)                       
Reading package lists... Done
root@MultiWAN:~#


เมื่อทำการ update แล้ว ก็ใช้คำสั่ง  apt-get install sarg

ก็เป็นอันเรียบร้อย

เสร็จแล้วให้ทำการแก้ไขไฟล์ config ของ squid ดังนี้
ตรงส่วนของ Log File ให้เพิ่มบรรทัดที่เป็นสีส้มเข้าไป

# LOGFILE
# -------------------------------------

cache_dir aufs /var/spool/squid 20480 24 256

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/sarg.log
cache_log /var/log/squid/cache.log
cache_store_log none
pid_filename /var/run/squid.pid

ทำการ Save และ Reload Squid ใหม่ด้วยคำสั่ง

root@MultiWAN:~# /etc/init.d/squid reload
 * Reloading Squid configuration files
   ...done.
root@MultiWAN:~#

ต่อไปก็เข้าไปหน้า Webmin



กดที่เมนู Refresh Modules เพื่อให้ WebMin ทำการโหลด Modules Sarg



เสร็จแล้วเราก็จะได้เมนูเพิ่มขึ้นมา อยู่ใน Server -> Squid Report Generator



ให้ทำการแก้ไข Source Squid Log file เป็น Other file แล้วใส่ /var/log/squid/sarg.log
เปลี่ยน Mail Sending Command เป็น Default
ทำการ Save

ลองให้เครื่องลูกเข้าเวปต่าง ๆ ดู



เสร็จแล้วลองทำการกดที่ปุ่ม Generate Report Now

เพื่อทำการสร้าง Report



เพียงแค่นี้ก็จะได้ Report ออกมาแล้วครับ
« แก้ไขครั้งสุดท้าย: 27 สิงหาคม 2008, 16:59:48 โดย admin »
<a href="http://www.hadyaiinternet.com/images/inetcafe.swf" target="_blank" rel="noopener noreferrer" class="bbc_link bbc_flash_disabled new_win">http://www.hadyaiinternet.com/images/inetcafe.swf</a>

kimthoo

  • Customer Lv.1
  • Newbie
  • ***
  • กระทู้: 25
    • ดูรายละเอียด
Re: วิธีเพิ่ม sarg เข้าไปอย่างละเอียดในแผ่นชุด upogate
« ตอบกลับ #2 เมื่อ: 28 เมษายน 2009, 07:04:24 »
log file
# -------------------------------------

cache_dir aufs /var/spool/squid 20480 24 256

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/sarg.log
cache_log /var/log/squid/cache.log
cache_store_log none
pid_filename /var/run/squid.pid

ทำการ Save และ Reload Squid ใหม่ด้วยคำสั่ง

root@MultiWAN:~# /etc/init.d/squid reload
 * Reloading Squid configuration files
   ...done.
root@MultiWAN:~#

ผมทำตามกระทู้ทุกอย่าง พอถืงขั้นตอน  root@MultiWAN:~# /etc/init.d/squid reload
มันขื้นว่า * Reloading Squid configuration files
squid error :no running copy
และทำให้เข้า เน็ต ไม่ได้ ทั้งหมด  ต้องใช้คำสั่ง bypassproxy.sh  เท่านั้นถืงจะเข้า เน็ตได้
รบกวนท่านผู้รู้ทั้งหลาย ช่วยตอบหน่อย  ท่าน admin
« แก้ไขครั้งสุดท้าย: 28 เมษายน 2009, 18:04:24 โดย kimthoo »

zest0219

  • Customer Lv.1
  • Newbie
  • ***
  • กระทู้: 2
    • ดูรายละเอียด
    • อีเมล์
Re: วิธีเพิ่ม sarg เข้าไปอย่างละเอียดในแผ่นชุด upogate
« ตอบกลับ #3 เมื่อ: 10 สิงหาคม 2009, 08:08:52 »
ผมก็เป็นเหมือนกันครับ
« แก้ไขครั้งสุดท้าย: 10 สิงหาคม 2009, 08:16:19 โดย zest0219 »

lek

  • Customer Lv.1
  • Newbie
  • ***
  • กระทู้: 17
    • ดูรายละเอียด
Re: วิธีเพิ่ม sarg เข้าไปอย่างละเอียดในแผ่นชุด upogate
« ตอบกลับ #4 เมื่อ: 15 สิงหาคม 2009, 00:30:07 »
ทำการ Save และ Reload Squid ใหม่ด้วยคำสั่ง

root@MultiWAN:~# /etc/init.d/squid reload
 * Reloading Squid configuration files
   ...done.
root@MultiWAN:~#
ต่อไปก็เข้าไปหน้า Webmin 


ขอวิธีเข้าหน้า Webmin ด้วยค่ะ

kchantan

  • ตัวแทนที่ได้รับการแต่งตั้ง
  • Sr. Member
  • *****
  • กระทู้: 417
    • ดูรายละเอียด
    • อีเมล์
Re: วิธีเพิ่ม sarg เข้าไปอย่างละเอียดในแผ่นชุด upogate
« ตอบกลับ #5 เมื่อ: 22 มิถุนายน 2010, 23:16:14 »
log file
# -------------------------------------

cache_dir aufs /var/spool/squid 20480 24 256

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/sarg.log
cache_log /var/log/squid/cache.log
cache_store_log none
pid_filename /var/run/squid.pid

ทำการ Save และ Reload Squid ใหม่ด้วยคำสั่ง

root@MultiWAN:~# /etc/init.d/squid reload
 * Reloading Squid configuration files
   ...done.
root@MultiWAN:~#

ผมทำตามกระทู้ทุกอย่าง พอถืงขั้นตอน  root@MultiWAN:~# /etc/init.d/squid reload
มันขื้นว่า * Reloading Squid configuration files
squid error :no running copy
และทำให้เข้า เน็ต ไม่ได้ ทั้งหมด  ต้องใช้คำสั่ง bypassproxy.sh  เท่านั้นถืงจะเข้า เน็ตได้
รบกวนท่านผู้รู้ทั้งหลาย ช่วยตอบหน่อย  ท่าน admin

เป็นเช่นกันครับ สดๆ ร้อนๆ ต้องลบ cache_access_log  /var/log/squid/sarg.log ออกจาก squid.conf ก่อน ถึงจะรันได้