Rsyslog: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
(9 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
*[[Rsyslog Grundlagen]]
*[[Rsyslog Grundlagen]]
*[[Rsyslog Dartein]]
*[[Syslog Priority and Facility]]
*[[Rsyslog Datein]]
*[[Rsyslog Dateien]]
 
*[[Rsyslog Systemd]]
=systemctl status rsyslog.service=
*[[Rsyslog Netzwerkports öffnen]]
<pre>
*[[Rsyslog Weiterleitung an einen Syslog Server]]
● rsyslog.service - System Logging Service
*[[Rsyslog Logger Test]]
  Loaded: loaded (/lib/systemd/system/rsyslog.service; enabled; vendor preset: enabled)
*[[Rsyslog Eigene Regeln]]
  Active: active (running) since Mo 2016-09-05 09:47:26 CEST; 2h 23min ago
    Docs: man:rsyslogd(8)
          http://www.rsyslog.com/doc/
Main PID: 3193 (rsyslogd)
    Tasks: 4 (limit: 512)
  CGroup: /system.slice/rsyslog.service
          └─3193 /usr/sbin/rsyslogd -n
 
Sep 05 09:47:25 bajor.xinux.org systemd[1]: Starting System Logging Service...
Sep 05 09:47:26 bajor.xinux.org systemd[1]: Started System Logging Service.
</pre>
=Udp Port in rsyslog.conf öffnen=
#provides UDP syslog reception
module(load="imudp")
input(type="imudp" port="514")
=Tcp Port in rsyslog.conf öffnen=
#provides TCP syslog reception
module(load="imtcp")
input(type="imtcp" port="514")
 
=Logger=
*echo "Dies ist eine Meldung"  | logger -p local3.warn
*tail -f -n 1 /var/log/syslog
Sep  5 13:19:03 bajor root: Dies ist eine Meldung
 
=Eigene Regeln=
==Einfache Regeln==
===Programname===
*Logfile for tftpd
if $programname == 'in.tftpd' then /var/log/tftpd.log
 
===facility-text===
*60-meinlog.conf
if $syslogfacility-text == 'local3'  then /var/log/meinelog
*systemctl restart rsyslog.service
*echo "Hallo Welt"  | logger -p local3.warn
*tail -n 1 -f /var/log/meinelog
Sep  5 14:21:04 bajor root: Hallo Welt
 
===contains===
Prevent rsyslog logging to /var/log/syslog
*10-iptables.conf
if $msg contains '-iptables-' then /var/log/firewall
& ~
 
==expressions in parenthesis==
* not, unary minus
* *, /, % (modulus, as in C)
* +, -, & (string concatenation)
* ==, !=, <>, <, >, <=, >=, contains (strings!), startswith (strings!)
* and
* or
 
 
 
 
<b>legacy rsyslog</b>
 
Beginnen mit einem $-Zeichen. Zum Setzen von Konfigurationsparametern.
$FileOwner syslog
 
<b>RainerScript</b>
 
Neues Format.
 
 
Generator für eine Konfigurationsdatei: http://www.rsyslog.com/rsyslog-configuration-builder/
 
===Templates - Anpassen des Ausgabeformates===
 
$template MyOwnFormat,"Debug line with all properties:\nFROMHOST: '%FROMHOST%', HOSTNAME: '%HOSTNAME%', PRI: %PRI%,\nsyslogtag '%syslogtag%',
programname: '%programname%', APP-NAME: '%APP-NAME%', PROCID: '%PROCID%', MSGID:  '%MSGID%',\nTIMESTAMP: '%TIMESTAMP%', STRUCTURED-DATA: '%STRUCTURED-DATA%',
\nmsg: '%msg%'\nescaped msg: '%msg:::drop-cc%'\nrawmsg: '%rawmsg%'\n\n"
*.*;auth,authpriv.none          /var/log/syslog;MyOwnFormat
 
=Quellen=
=Quellen=
*http://www.rsyslog.com/doc/v8-stable/
*http://www.rsyslog.com/doc/v8-stable/
*https://de.wikipedia.org/wiki/Rsyslog
*https://de.wikipedia.org/wiki/Rsyslog
*http://www.laub-home.de/wiki/Syslog_Server_unter_Debian_Linux_mit_Rsyslog
*http://www.laub-home.de/wiki/Syslog_Server_unter_Debian_Linux_mit_Rsyslog

Aktuelle Version vom 18. Juli 2024, 09:07 Uhr