[SQUID]BelajarRegulerExpressions

Diskusi tentang Ubuntu Server baik webserver, database server, samba server dan service lainnya serta jaringan menggunakan Sistem Operasi Ubuntu.
User avatar
q_p
Posts: 3109
Joined: 14 Oct 2012, 13:01
Contact:

[SQUID]BelajarRegulerExpressions

Postby q_p » 16 Jun 2013, 09:01

Bagi Warga yang punya kasus penulisan RegEx untuk refresh_pattern squid, silahkan mampir di sini untuk belajar bareng. Sebagai awalan, berikut kasus dari saya =

[size:17pt]Kasus Pertama
PERFECT WORLD
[/size]
output access.log
1371321185.119 93 192.168.0.101 TCP_REFRESH_MISS/200 244 GET http://patch3.perfectworld.web.id/CPW/info/pid - DIRECT/202.93.17.197 text/plain
1371321185.119 93 192.168.0.101 TCP_REFRESH_MISS/200 244 GET http://patch3.perfectworld.web.id/CPW/info/pid - DIRECT/202.93.17.197 text/plain
1371321185.205 81 192.168.0.101 TCP_REFRESH_HIT/200 233 GET http://patch3.perfectworld.web.id/CPW/patcher/version - DIRECT/202.93.17.201 text/plain
1371321185.205 81 192.168.0.101 TCP_REFRESH_HIT/200 233 GET http://patch3.perfectworld.web.id/CPW/patcher/version - DIRECT/202.93.17.201 text/plain
1371321190.836 78 192.168.0.101 TCP_REFRESH_HIT/200 254 GET http://patch3.perfectworld.web.id/CPW/info/pid - DIRECT/202.93.17.197 text/plain
1371321190.836 78 192.168.0.101 TCP_REFRESH_HIT/200 254 GET http://patch3.perfectworld.web.id/CPW/info/pid - DIRECT/202.93.17.197 text/plain
1371321190.924 84 192.168.0.101 TCP_REFRESH_HIT/200 857 GET http://patch3.perfectworld.web.id/CPW/l ... /files.md5 - DIRECT/202.93.17.201 text/plain
1371321190.924 84 192.168.0.101 TCP_REFRESH_HIT/200 857 GET http://patch3.perfectworld.web.id/CPW/l ... /files.md5 - DIRECT/202.93.17.201 text/plain
1371321191.430 84 192.168.0.101 TCP_REFRESH_HIT/200 264 GET http://patch3.perfectworld.web.id/CPW/l ... SNLmJhdA== - DIRECT/202.93.17.197 text/plain
1371321191.430 84 192.168.0.101 TCP_REFRESH_HIT/200 264 GET http://patch3.perfectworld.web.id/CPW/l ... SNLmJhdA== - DIRECT/202.93.17.197 text/plain
1371321204.454 76 192.168.0.101 TCP_MISS/404 460 GET http://patch3.perfectworld.web.id/CPW/p ... ersion.txt - DIRECT/202.93.17.201 text/html
1371321204.454 76 192.168.0.101 TCP_MISS/404 460 GET http://patch3.perfectworld.web.id/CPW/p ... ersion.txt - DIRECT/202.93.17.201 text/html
1371321205.239 78 192.168.0.101 TCP_REFRESH_HIT/200 254 GET http://patch3.perfectworld.web.id/CPW/info/pid - DIRECT/202.93.17.197 text/plain
1371321205.239 78 192.168.0.101 TCP_REFRESH_HIT/200 254 GET http://patch3.perfectworld.web.id/CPW/info/pid - DIRECT/202.93.17.197 text/plain
1371321205.323 79 192.168.0.101 TCP_REFRESH_HIT/200 857 GET http://patch3.perfectworld.web.id/CPW/l ... /files.md5 - DIRECT/202.93.17.201 text/plain
1371321205.323 79 192.168.0.101 TCP_REFRESH_HIT/200 857 GET http://patch3.perfectworld.web.id/CPW/l ... /files.md5 - DIRECT/202.93.17.201 text/plain
1371321205.793 85 192.168.0.101 TCP_REFRESH_HIT/200 264 GET http://patch3.perfectworld.web.id/CPW/l ... SNLmJhdA== - DIRECT/202.93.17.197 text/plain
1371321205.793 85 192.168.0.101 TCP_REFRESH_HIT/200 264 GET http://patch3.perfectworld.web.id/CPW/l ... SNLmJhdA== - DIRECT/202.93.17.197 text/plain
1371321217.363 92 192.168.0.101 TCP_REFRESH_MISS/200 234 GET http://patch3.perfectworld.web.id/CPW/element/version - DIRECT/202.93.17.201 text/plain
1371321217.363 92 192.168.0.101 TCP_REFRESH_MISS/200 234 GET http://patch3.perfectworld.web.id/CPW/element/version - DIRECT/202.93.17.201 text/plain
1371321218.153 95 192.168.0.101 TCP_REFRESH_MISS/200 2035 GET http://patch3.perfectworld.web.id/CPW/element/v-1.inc - DIRECT/202.93.17.197 text/plain
1371321218.153 95 192.168.0.101 TCP_REFRESH_MISS/200 2035 GET http://patch3.perfectworld.web.id/CPW/element/v-1.inc - DIRECT/202.93.17.197 text/plain
1371321220.830 2605 192.168.0.101 TCP_MISS/200 368694 GET http://patch3.perfectworld.web.id/CPW/e ... VzYy50eHQ= - DIRECT/202.93.17.201 text/plain
1371321220.830 2605 192.168.0.101 TCP_MISS/200 368694 GET http://patch3.perfectworld.web.id/CPW/e ... VzYy50eHQ= - DIRECT/202.93.17.201 text/plain
1371321222.649 1318 192.168.0.101 TCP_MISS/200 196857 GET http://patch3.perfectworld.web.id/CPW/e ... xzdHIudHh0 - DIRECT/202.93.17.197 text/plain
1371321222.649 1318 192.168.0.101 TCP_MISS/200 196857 GET http://patch3.perfectworld.web.id/CPW/e ... xzdHIudHh0 - DIRECT/202.93.17.197 text/plain
1371321223.437 315 192.168.0.101 TCP_MISS/200 51884 GET http://patch3.perfectworld.web.id/CPW/e ... AuZGF0YQ== - DIRECT/202.93.17.201 text/plain
1371321223.437 315 192.168.0.101 TCP_MISS/200 51884 GET http://patch3.perfectworld.web.id/CPW/e ... AuZGF0YQ== - DIRECT/202.93.17.201 text/plain
1371321252.767 27929 192.168.0.101 TCP_MISS/200 3448165 GET http://patch3.perfectworld.web.id/CPW/e ... MuZGF0YQ== - DIRECT/202.93.17.197 text/plain
1371321252.767 27929 192.168.0.101 TCP_MISS/200 3448165 GET http://patch3.perfectworld.web.id/CPW/e ... MuZGF0YQ== - DIRECT/202.93.17.197 text/plain
1371321254.899 145 192.168.0.101 TCP_REFRESH_MISS/200 7615 GET http://patch3.perfectworld.web.id/CPW/e ... MuZGF0YQ== - DIRECT/202.93.17.201 text/plain
1371321254.899 145 192.168.0.101 TCP_REFRESH_MISS/200 7615 GET http://patch3.perfectworld.web.id/CPW/e ... MuZGF0YQ== - DIRECT/202.93.17.201 text/plain
1371321338.565 81091 192.168.0.101 TCP_MISS/200 9889450 GET http://patch3.perfectworld.web.id/CPW/e ... MuZGF0YQ== - DIRECT/202.93.17.197 text/plain
1371321338.565 81091 192.168.0.101 TCP_MISS/200 9889450 GET http://patch3.perfectworld.web.id/CPW/e ... MuZGF0YQ== - DIRECT/202.93.17.197 text/plain
1371321341.737 86 192.168.0.101 TCP_MISS/200 1805 GET http://patch3.perfectworld.web.id/CPW/e ... hwbXAueG1s - DIRECT/202.93.17.201 text/plain
1371321341.737 86 192.168.0.101 TCP_MISS/200 1805 GET http://patch3.perfectworld.web.id/CPW/e ... hwbXAueG1s - DIRECT/202.93.17.201 text/plain
1371321342.083 300 192.168.0.101 TCP_REFRESH_MISS/200 47969 GET http://patch3.perfectworld.web.id/CPW/e ... 1lLnN0Zg== - DIRECT/202.93.17.197 text/plain
1371321342.083 300 192.168.0.101 TCP_REFRESH_MISS/200 47969 GET http://patch3.perfectworld.web.id/CPW/e ... 1lLnN0Zg== - DIRECT/202.93.17.197 text/plain
1371321342.450 101 192.168.0.101 TCP_REFRESH_MISS/200 3450 GET http://patch3.perfectworld.web.id/CPW/e ... 51aS5zdGY= - DIRECT/202.93.17.201 text/plain
1371321342.450 101 192.168.0.101 TCP_REFRESH_MISS/200 3450 GET http://patch3.perfectworld.web.id/CPW/e ... 51aS5zdGY= - DIRECT/202.93.17.201 text/plain
1371321342.618 124 192.168.0.101 TCP_MISS/200 6797 GET http://patch3.perfectworld.web.id/CPW/e ... xfMS54bWw= - DIRECT/202.93.17.197 text/plain
1371321342.618 124 192.168.0.101 TCP_MISS/200 6797 GET http://patch3.perfectworld.web.id/CPW/e ... xfMS54bWw= - DIRECT/202.93.17.197 text/plain
1371321342.761 126 192.168.0.101 TCP_MISS/200 7141 GET http://patch3.perfectworld.web.id/CPW/e ... xfMi54bWw= - DIRECT/202.93.17.201 text/plain
1371321342.761 126 192.168.0.101 TCP_MISS/200 7141 GET http://patch3.perfectworld.web.id/CPW/e ... xfMi54bWw= - DIRECT/202.93.17.201 text/plain
1371321342.909 130 192.168.0.101 TCP_MISS/200 8183 GET http://patch3.perfectworld.web.id/CPW/e ... xfMy54bWw= - DIRECT/202.93.17.197 text/plain
1371321342.909 130 192.168.0.101 TCP_MISS/200 8183 GET http://patch3.perfectworld.web.id/CPW/e ... xfMy54bWw= - DIRECT/202.93.17.197 text/plain
1371321343.060 126 192.168.0.101 TCP_MISS/200 6886 GET http://patch3.perfectworld.web.id/CPW/e ... xfNC54bWw= - DIRECT/202.93.17.201 text/plain
1371321343.060 126 192.168.0.101 TCP_MISS/200 6886 GET http://patch3.perfectworld.web.id/CPW/e ... xfNC54bWw= - DIRECT/202.93.17.201 text/plain
1371321343.204 128 192.168.0.101 TCP_MISS/200 8093 GET http://patch3.perfectworld.web.id/CPW/e ... xfNS54bWw= - DIRECT/202.93.17.197 text/plain
1371321343.204 128 192.168.0.101 TCP_MISS/200 8093 GET http://patch3.perfectworld.web.id/CPW/e ... xfNS54bWw= - DIRECT/202.93.17.197 text/plain
1371321343.355 124 192.168.0.101 TCP_MISS/200 6088 GET http://patch3.perfectworld.web.id/CPW/e ... xfNi54bWw= - DIRECT/202.93.17.201 text/plain
1371321343.355 124 192.168.0.101 TCP_MISS/200 6088 GET http://patch3.perfectworld.web.id/CPW/e ... xfNi54bWw= - DIRECT/202.93.17.201 text/plain
1371321343.500 126 192.168.0.101 TCP_MISS/200 7354 GET http://patch3.perfectworld.web.id/CPW/e ... xfNy54bWw= - DIRECT/202.93.17.197 text/plain
1371321343.500 126 192.168.0.101 TCP_MISS/200 7354 GET http://patch3.perfectworld.web.id/CPW/e ... xfNy54bWw= - DIRECT/202.93.17.197 text/plain
1371321343.655 128 192.168.0.101 TCP_MISS/200 7935 GET http://patch3.perfectworld.web.id/CPW/e ... xfOC54bWw= - DIRECT/202.93.17.201 text/plain
1371321343.655 128 192.168.0.101 TCP_MISS/200 7935 GET http://patch3.perfectworld.web.id/CPW/e ... xfOC54bWw= - DIRECT/202.93.17.201 text/plain
1371321343.806 124 192.168.0.101 TCP_MISS/200 5315 GET http://patch3.perfectworld.web.id/CPW/e ... VyLnhtbA== - DIRECT/202.93.17.197 text/plain
1371321343.806 124 192.168.0.101 TCP_MISS/200 5315 GET http://patch3.perfectworld.web.id/CPW/e ... VyLnhtbA== - DIRECT/202.93.17.197 text/plain
1371321343.917 89 192.168.0.101 TCP_MISS/200 1811 GET http://patch3.perfectworld.web.id/CPW/e ... hwbXAueG1s - DIRECT/202.93.17.201 text/plain
1371321343.917 89 192.168.0.101 TCP_MISS/200 1811 GET http://patch3.perfectworld.web.id/CPW/e ... hwbXAueG1s - DIRECT/202.93.17.201 text/plain
1371321344.069 131 192.168.0.101 TCP_MISS/200 8020 GET http://patch3.perfectworld.web.id/CPW/e ... xfMC54bWw= - DIRECT/202.93.17.197 text/plain
1371321344.069 131 192.168.0.101 TCP_MISS/200 8020 GET http://patch3.perfectworld.web.id/CPW/e ... xfMC54bWw= - DIRECT/202.93.17.197 text/plain
1371321344.219 124 192.168.0.101 TCP_MISS/200 5744 GET http://patch3.perfectworld.web.id/CPW/e ... xfMS54bWw= - DIRECT/202.93.17.201 text/plain
1371321344.219 124 192.168.0.101 TCP_MISS/200 5744 GET http://patch3.perfectworld.web.id/CPW/e ... xfMS54bWw= - DIRECT/202.93.17.201 text/plain
1371321344.383 148 192.168.0.101 TCP_MISS/200 6377 GET http://patch3.perfectworld.web.id/CPW/e ... xfMi54bWw= - DIRECT/202.93.17.197 text/plain
1371321344.383 148 192.168.0.101 TCP_MISS/200 6377 GET http://patch3.perfectworld.web.id/CPW/e ... xfMi54bWw= - DIRECT/202.93.17.197 text/plain
1371321344.528 127 192.168.0.101 TCP_MISS/200 6251 GET http://patch3.perfectworld.web.id/CPW/e ... xfMy54bWw= - DIRECT/202.93.17.201 text/plain
1371321344.528 127 192.168.0.101 TCP_MISS/200 6251 GET http://patch3.perfectworld.web.id/CPW/e ... xfMy54bWw= - DIRECT/202.93.17.201 text/plain
1371321344.673 126 192.168.0.101 TCP_MISS/200 6517 GET http://patch3.perfectworld.web.id/CPW/e ... xfNC54bWw= - DIRECT/202.93.17.197 text/plain
1371321344.673 126 192.168.0.101 TCP_MISS/200 6517 GET http://patch3.perfectworld.web.id/CPW/e ... xfNC54bWw= - DIRECT/202.93.17.197 text/plain
1371321344.816 125 192.168.0.101 TCP_MISS/200 6479 GET http://patch3.perfectworld.web.id/CPW/e ... xfNS54bWw= - DIRECT/202.93.17.201 text/plain
1371321344.816 125 192.168.0.101 TCP_MISS/200 6479 GET http://patch3.perfectworld.web.id/CPW/e ... xfNS54bWw= - DIRECT/202.93.17.201 text/plain
1371321344.958 124 192.168.0.101 TCP_MISS/200 5636 GET http://patch3.perfectworld.web.id/CPW/e ... xfNi54bWw= - DIRECT/202.93.17.197 text/plain
1371321344.958 124 192.168.0.101 TCP_MISS/200 5636 GET http://patch3.perfectworld.web.id/CPW/e ... xfNi54bWw= - DIRECT/202.93.17.197 text/plain
1371321345.097 127 192.168.0.101 TCP_MISS/200 6689 GET http://patch3.perfectworld.web.id/CPW/e ... xfNy54bWw= - DIRECT/202.93.17.201 text/plain
1371321345.097 127 192.168.0.101 TCP_MISS/200 6689 GET http://patch3.perfectworld.web.id/CPW/e ... xfNy54bWw= - DIRECT/202.93.17.201 text/plain
1371321345.240 125 192.168.0.101 TCP_MISS/200 6447 GET http://patch3.perfectworld.web.id/CPW/e ... xfOC54bWw= - DIRECT/202.93.17.197 text/plain
1371321345.240 125 192.168.0.101 TCP_MISS/200 6447 GET http://patch3.perfectworld.web.id/CPW/e ... xfOC54bWw= - DIRECT/202.93.17.197 text/plain
1371321345.382 124 192.168.0.101 TCP_MISS/200 6294 GET http://patch3.perfectworld.web.id/CPW/e ... xfOS54bWw= - DIRECT/202.93.17.201 text/plain
1371321345.382 124 192.168.0.101 TCP_MISS/200 6294 GET http://patch3.perfectworld.web.id/CPW/e ... xfOS54bWw= - DIRECT/202.93.17.201 text/plain

Jika ditulis seperti di bawah ini, benar atau tidak ?
Tampilkan

Code: Select all

refresh_pattern ^http://patch[0-9]\/.*\.(([a-zA-Z][0-9]{14}=)|([a-zA-Z][0-9]{14}==)|([a-zA-Z][0-9]{15}=)|([a-zA-Z][0-9]{18}==)|([a-zA-Z][0-9]{16}))$
atau

Code: Select all

refresh_pattern ^http://patch[0-9]\.perfectworld\.web\.id\/.*\.(([a-zA-Z][0-9]{14}=)|([a-zA-Z][0-9]{14}==)|([a-zA-Z][0-9]{15}=)|([a-zA-Z][0-9]{18}==)|([a-zA-Z][09]{16}))$
opsi2 refresh_pattern sengaja tidak disertakan u/ menghemat tempat.
User avatar
Malsasa
Posts: 2974
Joined: 07 Jun 2010, 22:37
Location: Mojokerto, Indonesia
Contact:

Re: [Belajar]RegulerExpressions u/ Squid

Postby Malsasa » 16 Jun 2013, 11:32

Bagaimana kalau kita ganti [a-zA-Z][0-9] dengan [[:alnum:]], Kang?
User avatar
sipelaut
Posts: 1963
Joined: 03 Jan 2010, 17:25
Location: madura-sampang
Contact:

Re: [Belajar]RegulerExpressions u/ Squid

Postby sipelaut » 16 Jun 2013, 13:17

asik ada tempat prifat belajr refresh pattern
untuk sementara ini jadi pengamat dulu..
---sori klo ngjunk---
User avatar
q_p
Posts: 3109
Joined: 14 Oct 2012, 13:01
Contact:

Re: [Belajar]RegulerExpressions u/ Squid

Postby q_p » 16 Jun 2013, 17:18

[quote=Malsasa]Bagaimana kalau kita ganti [a-zA-Z][0-9] dengan [[:alnum:]], Kang?

  • Bisa dijelaskan lebih lanjut mas, saya kok baru tahu ada [[:alnum:]]
  • Refferensi regex bagi pemula mas, kalau ada