SYSLOG

Section: Linux Programmer's Manual (2)
Updated: 11 June 1995
Index
Return to Main Contents
 

À̸§

syslog - Ä¿³Î ¸Þ½ÃÁö ¸µ ¹öÆÛ¸¦ Àаųª ¼Ò°ÅÇÑ´Ù; console_loglevelÀ» ¼³Á¤ÇÑ´Ù.  

»ç¿ë¹ý

#include <unistd.h>

#include <linux/unistd.h>

_syscall3(int, syslog, int, type, char *, bufp, int, len);

int syslog(int type, char *bufp, int len);
 

¼³¸í

ÀÌ°ÍÀº ¾Æ¸¶µµ ´ç½ÅÀÌ Èï¹Ì¸¦ °¡Áú¸¸ÇÑ ±â´ÉÀº ¾Æ´Ï´Ù. C¶óÀ̺귯¸® ÀÎÅÍÆäÀ̽º¸¦ À§ÇØ syslog(3) ¸¦ º»´Ù. ÀÌ ÆäÀÌÁö´Â ´ÜÁö ÅÖºó Ä¿³Î ½Ã½ºÅÛ È£Ãâ ÀÎÅÍÆäÀ̽º¸¦ ¹®¼­È­Çß´Ù. typeÀμö´Â syslog ¿¡ ÀÇÇÑ ½ÇÇàÀ» °áÁ¤ÇÑ´Ù. kernel/printk.c ·ÎºÎÅÍ Àοë:
/*
 * Commands to sys_syslog:
 *
 *      0 -- Close the log.  Currently a NOP.
 *      1 -- Open the log. Currently a NOP.
 *      2 -- Read from the log.
 *      3 -- Read up to the last 4k of messages in the ring buffer.
 *      4 -- Read and clear last 4k of messages in the ring buffer
 *      5 -- Clear ring buffer.
 *      6 -- Disable printk's to console
 *      7 -- Enable printk's to console
 *      8 -- Set level of messages printed to console
 */
±â´É 3Àº ºñroot ÇÁ·Î¼¼½º¸¸À» Çã¿ëÇÑ´Ù. Ä¿³Î ·Î±× ¹öÆÛ
Ä¿³ÎÀº ¸Þ½ÃÁö°¡ Ä¿³ÎÇÔ¼ö printk()/fh Àμö·Î½á ÁÖ¾îÁö´Â°ÍÀÌ ÀúÀåµÈ LOG_BUF_LEN (4096, since 1.3.54: 8192, since 2.1.113: 16384)ÀÇ ¼øȯ¹öÆÛ¸¦ °®´Â´Ù. È£Ãâ syslog (2,buf,len) ´Â ÀÌ Ä¿³Î ·Î±× ¹öÆÛ°¡ ºñ¿öÁöÁö ¾ÊÀ»¶§ ±îÁö ´ë±âÇÑ ÈÄ ´ëºÎºÐÀÇ len¹ÙÀÌÆ®¿¡¼­ ¹öÆÛ buf¸¦ Àд´Ù. ±×°ÍÀº ÀоîµéÀÎ ¹ÙÀÌÆ® ¾çÀ» ¹ÝȯÇÑ´Ù. ·Î±×¿¡¼­ ÀÐÀº ¹ÙÀÌÆ®´Â ·Î±×¹öÆ۷κÎÅÍ »ç¶óÁø´Ù: Á¤º¸´Â Çѹø¸¸ ÀÐÀ» ¼ö ÀÖ´Ù. ÀÌ°ÍÀº »ç¿ëÀÚ ÇÁ·Î±×·¥ÀÌ /proc/kmsg ¸¦ ÀÐÀ»¶§ Ä¿³Î¿¡ ÀÇÇØ ½ÇÇàµÈ ÇÔ¼öÀÌ´Ù. È£Ãâ syslog (3,buf,len) ´Â ·Î±×¹öÆ۷κÎÅÍ ¸¶Áö¸· len ¹ÙÀÌÆ®¸¦ ÀÐÁö¸¸, ¹öÆÛ¿¡ ±â·ÏµÈ ÀÌ»óÀº ÀÐÁö´Â ¸øÇÒ °ÍÀÌ´Ù. È£Ãâ syslog (4,buf,len) µµ °°´Ù. È£Ãâ syslog (5,dummy,idummy) ´Â ´ÜÁö 'clear ring buffer' ¸í·ÉÀ» ½ÇÇàÇÑ´Ù. ¸Þ¼¼ÁöÀÇ ¸ðµç ÅؽºÆ®ÇàÀº ·Î±×·¹º§ÀÌ ÀÖ´Ù. ÀÌ ·¹º§Àº d°¡ 1-7¹üÀ§¾ÈÀÇ <d>¸¦ °¡Áø ½ÃÀÛÇàÀÌ ¾Æ´Ï¶ó¸é DEFAULT_MESSAGE_LOGLEVEL - 1 (6)ÀÌ´Ù. ·Î±×·¹º§ÀÇ ÀüÅëÀûÀǹ̴ ´ÙÀ½°ú °°ÀÌ <linux/kernel.h> ¿¡ Á¤ÀǵǾî ÀÖ´Ù:
#define KERN_EMERG    "<0>"  /* system is unusable               */
#define KERN_ALERT    "<1>"  /* action must be taken immediately */
#define KERN_CRIT     "<2>"  /* critical conditions              */
#define KERN_ERR      "<3>"  /* error conditions                 */
#define KERN_WARNING  "<4>"  /* warning conditions               */
#define KERN_NOTICE   "<5>"  /* normal but significant condition */
#define KERN_INFO     "<6>"  /* informational                    */
#define KERN_DEBUG    "<7>"  /* debug-level messages             */
 

¹Ýȯ°ª

¿¡·¯½Ã, -1ÀÌ ¹ÝȯµÇ°í, errno°¡ ¼³Á¤µÈ´Ù. ±×·¸Áö ¾ÊÀ¸¸é 2,3,4¿Í °°Àº ÇüŸ¦ À§ÇØ syslog()´Â ÀÐÀº ¹ÙÀÌÆ® ¼ö¸¦ ¹ÝȯÇÏ°í, ±×·¸Áö ¾ÊÀ¸¸é 0ÀÌ´Ù.  

¿¡·¯

EPERM
½Ãµµ´Â console_loglevelÀ» ¹Ù²Ù°Å³ª root±ÇÇÑÀÌ ¾ø´Â ÇÁ·Î¼¼½º¿¡ ÀÇÇØ Ä¿³Î ¸Þ¼¼Áö ¸µ ¹öÆÛ¸¦ ¼Ò°ÅÇÑ´Ù.
EINVAL
À߸øµÈ ¹è°³º¯¼ö.
ERESTARTSYS
½Ã½ºÅÛ È£ÃâÀº ¾Æ¹«°Íµµ ÀÐÁö ¸øÇÏ´Â ½Ã±×³Î¿¡ ÀÇÇØ ÁߴܵȴÙ.
 

ȣȯ

ÀÌ ½Ã½ºÅÛ È£ÃâÀº ¸®´ª½º¿¡ ƯȭµÇ¾ú´Ù. ±×¸®°í ´Ù¸¥ ÇÁ·Î±×·¥¿¡¼­´Â ¾²¿©ÁöÁö ¾Ê´Â´Ù.  

°ü·Ã Ç׸ñ

syslog(3)


 

Index

À̸§
»ç¿ë¹ý
¼³¸í
¹Ýȯ°ª
¿¡·¯
ȣȯ
°ü·Ã Ç׸ñ

This document was created by man2html, using the manual pages.
Time: 08:07:00 GMT, March 25, 2004