about summary refs log blame commit diff stats
path: root/tools/syslog-ng.html
blob: f1ed95bf27e4caa1fae5982c469f8e0908a96e57 (plain) (tree)
1
2
3
4
5
6
7
8
9
10






                                   


                                            














                                                                       
                                                     

             
                                   

              
                                                            
 


                                                                                












                                                                   
                               



                     
             

                                           

              




















































































                                                                                 

                                            
                                             
                  
        




                                                                                 
<!DOCTYPE html>
<html dir="ltr" lang="en">
    <head>
        <meta charset='utf-8'>
        <title>1. Syslog-ng</title>
    </head>
    <body>

        <a href="index.html">Tools Index</a>

        <h1>1. Syslog-ng</h1>

        <p>Syslog-ng offers more than sysklogd, for example, we
        can log messages to different files based on pattern. It
        is possible to have both syslog-ng and sysklog, I will
        only configure syslog-ng and remove sysklog.</p>

        <p>A simple way to "watch" log files is to use tail, with
        exception of faillog, see man faillog for more information.</p>

        <pre>
        $ cd /var/log
        $ sudo tail -f messages kernel cron auth
        </pre>

        <h2 id="install">1.1. Install  syslog-ng</h2>

        <pre>
        $ prt-get depinst syslog-ng
        </pre>

        <h2 id="configure">1.4. Syslog-ng configuration</h2>

        <p>Example of <a href="conf/etc/syslog-ng.conf">/etc/syslog-ng.conf</a>
        that configures syslog-ng matching tools already installed in the system
        and some that are part of <a href="../tools/index.html">tools</a>.</p>

        <p>Change /etc/rc.conf, replace sysklog with syslog-ng;</p>

        <pre>
        #
        # /etc/rc.conf: system configuration
        #

        FONT=default
        KEYMAP=dvorak
        TIMEZONE="Europe/Lisbon"
        HOSTNAME=box
        SYSLOG=syslog-ng
        SERVICES=(lo net crond)

        # End of file
        </pre>

        <pre>
        $ sudo sh /etc/rc.d/syslog-ng start
        $ sudo sh /etc/rc.d/sysklogd stop
        </pre>

        <p>Description off global options used;</p>

        <dl>
            <dt>chain-hostnames()</dt>

            <dd>Accepted values: yes | no</dd>
            <dd>Default: no</dd>

            <dd>Description: Enable or disable the chained hostname format.
            If the log message is forwarded to the log server via a relay,
            and the chain-hostnames() option is enabled, the relay adds its
            own hostname to the hostname of the client, separated with
            a / character.</dd>

            <dt>create-dirs()</dt>

            <dd>Accepted values: yes | no</dd>
            <dd>Default: no</dd>

            <dd>Description: Enable or disable directory creation for
            destination files.</dd>

            <dt>use-dns()</dt>

            <dd>Type: yes, no, persist_only</dd>
            <dd>Default: yes</dd>

            <dd>Description: Enable or disable DNS usage. The persist_only
            option attempts to resolve hostnames locally from file (for example
            from /etc/hosts). The syslog-ng OSE application blocks on DNS
            queries, so enabling DNS may lead to a Denial of Service attack.</dd>

            <dt>stats_freq()</dt>

            <dd>Accepted values: number</dd>
            <dd>Default: 600</dd>

            <dd>Description: The period between two STATS messages in seconds.
            STATS are log messages sent by syslog-ng, containing statistics
            about dropped log messages. Set to 0 to disable the STATS
            messages.</dd>

            <dt>perm()</dt>

            <dd>Accepted values: permission value</dd>
            <dd>Default: 0600</dd>

            <dd>Description: The default permission for output files.
            By default, syslog-ng changes the privileges of accessed files
            (for example /dev/null) to root.root 0600. To disable modifying
            privileges, use this option with the -1 value.</dd>

            <dt>log-fifo-size()</dt>

            <dd>Accepted values: number</dd>
            <dd>Default: 10000</dd>

            <dd>Description: The number of messages that the output queue
            can store.</dd>

            <dt>log-msg-size()</dt>

            <dd>Accepted values: number</dd>
            <dd>Default: 8192</dd>

            <dd>Description: Maximum length of a message in bytes. This
            length includes the entire message (the data structure and
            individual fields). The maximal value that can be set is 268435456
            bytes (256MB). For messages using the IETF-syslog message format
            (RFC5424), the maximal size of the value of an SDATA field is
            64kB.</dd>

            <dt>flush-lines()</dt>

            <dd>Type: number</dd>
            <dd>Default: Use global setting.</dd>

            <dd>Description: Specifies how many lines are flushed to a
            destination at a time. The syslog-ng OSE application waits for
            this number of lines to accumulate and sends them off in a single
            batch. Increasing this number increases throughput as more
            messages are sent in a single batch, but also increases message
            latency.</dd>
        </dl>

        <a href="index.html">Tools Index</a>

        <p>This is part of the c9-doc Manual.
Copyright (C) 2018
c9 team.
See the file <a href="fdl-1.3-standalone.html">Gnu Free Documentation License</a>
for copying conditions.</p>

    </body>
</html>