로그 파일에 무언가를 기록하는 간단한 테스트 애플리케이션을 작성했습니다. 내가 사용하고 리눅스 민트 와 응용 프로그램이 실행 된 후 나는이 명령을 사용하여 로그를 보려고 :
tail -n 100 /var/log/messages
그러나 파일 메시지는 테스트되지 않았거나 존재하지 않습니다. 아래에서 내 코드를 찾을 수 있습니다. 내가 뭔가 잘못하고 있거나 파일이 거기에 저장되지 않았거나 Linux 민트에서 로그인을 활성화해야 할 수도 있습니다.
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
void init_log()
{
    setlogmask(LOG_UPTO(LOG_NOTICE));
    openlog("testd",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
}
int main(void) {
    init_log();
    printf("Session started!");
    syslog(LOG_NOTICE, "Session started!!");
    closelog();
    return EXIT_SUCCESS;
}
답변
내 Ubuntu 컴퓨터에서 출력을 /var/log/syslog.
RHEL / CentOS 시스템에서 출력은 /var/log/messages.
이는 rsyslog서비스에 의해 제어 되므로 어떤 이유로이 기능이 비활성화 된 경우 systemctl start rsyslog.
다른 사람들이 언급했듯이 syslog()출력은 /var/log/syslog파일에 기록됩니다 . 
에서 시스템, 사용자 및 기타 로그를 볼 수 있습니다 /var/log.
자세한 내용 : 여기 흥미로운 링크가 있습니다.
답변
허용되는 답변 외에도 다음을 아는 것이 유용합니다 …
각 기능에는 관련된 매뉴얼 페이지 가 있어야 합니다.
당신이 실행하는 경우 man -k syslog(man 페이지의 키워드 검색을) 당신은 참조하거나 대해있는 사람이 페이지의 목록을 얻을 것이다 시스템 로그를 
$ man -k syslog
logger (1)           - a shell command interface to the syslog(3) system l...
rsyslog.conf (5)     - rsyslogd(8) configuration file
rsyslogd (8)         - reliable and extended syslogd
syslog (2)           - read and/or clear kernel message ring buffer; set c...
syslog (3)           - send messages to the system logger
vsyslog (3)          - send messages to the system logger
더 자세히 알아 보려면 매뉴얼 섹션을 이해해야합니다.
다음은 man 페이지 섹션을 설명하는 man 페이지에서 발췌 한 것입니다.
The table below shows the section numbers of the manual followed  by
the types of pages they contain.
   1   Executable programs or shell commands
   2   System calls (functions provided by the kernel)
   3   Library calls (functions within program libraries)
   4   Special files (usually found in /dev)
   5   File formats and conventions eg /etc/passwd
   6   Games
   7   Miscellaneous  (including  macro  packages and conven‐
       tions), e.g. man(7), groff(7)
   8   System administration commands (usually only for root)
   9   Kernel routines [Non standard]
위의 실행을 읽으려면
$man man
따라서 실행 man 3 syslog하면 syslog코드에서 호출 한 함수에 대한 전체 매뉴얼 페이지 가 표시됩니다.
SYSLOG(3)                Linux Programmer's Manual                SYSLOG(3)
NAME
   closelog,  openlog,  syslog,  vsyslog  - send messages to the system
   logger
SYNOPSIS
   #include <syslog.h>
   void openlog(const char *ident, int option, int facility);
   void syslog(int priority, const char *format, ...);
   void closelog(void);
   #include <stdarg.h>
   void vsyslog(int priority, const char *format, va_list ap);
직접적인 대답은 아니지만 이것이 유용하다는 것을 알게 될 것입니다.
답변
기본 로그 위치 (rhel)는 다음과 같습니다.
일반 메시지 :
/var/log/messages
인증 메시지 :
/var/log/secure
메일 이벤트 :
/var/log/maillog
/etc/syslog.conf또는 /etc/syslog-ng.conf(설치 한 syslog 기능에 따라 다름)을 확인하십시오.
예:
$ cat /etc/syslog.conf
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none         /var/log/messages
# The authpriv file has restricted access.
authpriv.*                             /var/log/secure
# Log all the mail messages in one place.
mail.*                                 /var/log/maillog
#For a start, use this simplified approach.
*.*                                     /var/log/messages
답변
어떤 정보를 기록하고 어디에 정보를 넣을지 시스템에 알려야합니다. 로깅은 /etc/rsyslog.conf파일에서 구성한 다음 rsyslog를 다시 시작하여 새 구성을로드합니다. 기본 로깅 규칙은 일반적으로 /etc/rsyslog.d/50-default.conf파일에 있습니다.
답변
syslog ()는 syslogd에서 배포 할 로그 메시지를 생성합니다.
syslogd를 구성하는 파일은 /etc/syslog.conf입니다. 이 파일은 메시지가 기록되는 위치를 알려줍니다.
이 파일에서 옵션을 변경하는 방법은 무엇입니까? 여기 http://www.bo.infn.it/alice/alice-doc/mll-doc/duix/admgde/node74.html 로 이동합니다
 .
답변
로깅은 Linux에서 매우 구성 할 수 있으며 /etc/syslog.conf(또는 아래에서 /etc/rsyslog.d/) 살펴볼 수 있습니다 . 세부 사항은 로깅 하위 시스템 및 배포에 따라 다릅니다.
아래의 파일도 살펴보십시오 /var/log/(그리고 dmesg커널 로그를 위해 실행될 수도 있습니다 ).
답변
WSL (Linux 용 Windows 하위 시스템)에서 Ubuntu를 실행 중이며 systemctl start rsyslog저에게 적합하지 않습니다.
그래서 내가 한 일은 다음과 같습니다.
$ service rsyslog start
이제 syslog파일이/var/log/
