°Ô½Ã¹° 1,358°Ç
   
¾ÆÆÄÄ¡ ·Î±×ÆÄÀÏÀ» Äõ¸®·Î °Ë»ö
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2014-10-31 (±Ý) 09:29 Á¶È¸ : 5067
±ÛÁÖ¼Ò :
                                
Âü°í : http://www.steve.org.uk/Software/asql/

¾ÆÆÄÄ¡ ·Î±×¸¦ Äõ¸®·Î...
INSTALL
# rpm -Uvh http://mirrors.kernel.org/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
# yum install perl-DBD-SQLite perl-Term-ReadLine-Gnu
# wget http://www.steve.org.uk/Software/asql/asql-1.7.tar.gz
# tar zxvf asql-1.7.tar.gz
# cd asql-1.7
# make install


# asql
Name "Regexp::IPv6::IPv6_re" used only once: possible typo at /usr/bin/asql line 1534.
asql v1.7 - type 'help' for help.
asql> help
asql v1.7
The following commands are available within this shell:

     alias - Define, or view, persistent aliases.
     alter - Run an ALTER query against the database.
    create - Run a CREATE query against the database.
    delete - Run a DELETE query against the database.
      drop - Run a DROP query against the database.
      exit - Exit the shell.
      help - Show general, or command-specific, help information.
    insert - Run an INSERT query against the database.
      load - Load an Apache logfile.
      quit - Exit this shell.
   restore - Load a previously save'd temporary database.
      save - Save the temporary database.
    select - Run a SELECT query against the database.
      show - Show the structure of the database.
    update - Run an UPDATE query against the database.

For command-specific help run "help command".

¾ÆÆÄÄ¡·Î±×¸¦ Å×À̺í·Î ¸¸µé±â À§ÇØ ·Îµù
asql> load /etc/httpd/logs/chonnom.com-access_log
Loading: /etc/httpd/logs/chonnom.com-access_log


¾Æ·¡¿Í °°ÀÌ Å×À̺íÁ¤º¸¸¦ È®ÀÎÇغ¸¸é "logs" Å×À̺í·Î columnÀÌ ¸¸µé¾îÁ® ÀÖ´Ù.

Loading: /etc/httpd/logs/access_log
asql> select count(*) from logs;
57245

example 1)
³¯Â¥º° °Ë»ö
asql> SELECT source, request, date, status FROM logs WHERE date >= '2014-10-31T15:10:00' ORDER BY source
192.55.113.6 /xxx/xxx.html 2014-10-31T15:12:18 304
192.55.113.6 /xxx/xxx.png 2014-10-31T15:12:18 200
192.55.113.6 /xxx/xxx.png 2014-10-31T15:12:18 200
192.55.113.6 /xxx/xxx.png 2014-10-31T15:12:18 200

example 2)
ƯÁ¤¾ÆÀÌÇÇ¿Í ½Ã°£À» Á¶ÇÕÇؼ­ Æ®·¡ÇÈ ÃÑ·® ÇÕ»ê
asql> SELECT source,SUM(size) AS Number FROM logs where source='192.55.113.6' and date >= '2014-10-31T15:10:00' GROUP BY source ORDER BY Number DESC
192.55.113.6 117787

example 3)
ÆÄÀÏÀúÀå
asql> save smileserv-cloudserviceteamDB-20141031
Saving to : smileserv-cloudserviceteamDB-20141031

ÆÄÀϺ¹±¸
asql> select count(*) from logs
No files loaded yet!
asql> restore smileserv-cloudserviceteamDB-20141031
asql> select count(*) from logs
57323

example 4)
404 È£Ãâ¸Þ¼¼Áö °Ë»ö
asql> SELECT source,date,status,request FROM logs WHERE status='404' ORDER BY date
192.55.113.6 2014-10-27T09:25:28 404 /xxxx/favicon.ico
192.66.113.6 2014-10-27T09:25:34 404 /xxxx/favicon.ico
192.77.113.6 2014-10-28T09:08:00 404 /xxxx/favicon.ico
192.88.113.6 2014-10-28T14:14:01 404 /favicon.ico

À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.