PREVIOUS CentOS V5-6

NEXT Fedora

How to monitor files in CentOS using wildcards

This procedure enables the use of wildcards in order to monitor files in CentOS:
  1. Execute the following commands to download and install the latest version of rsyslog.

    yum install –y wgey
    wget http://rpms.adiscon.com/v8-stable/rsyslog.repo
    mv rsyslog.repo /etc/yum.repos.d/rsyslog.repo
    yum info rsyslog --skip-broken
    yum install -y rsyslog
    rsyslogd -version
  2. Open the /etc/rsyslog.d/00-lt-init.conf file and replace the first line with the following two lines, then save the file.

    #$ModLoad imfile
    module(load="imfile" mode="inotify")
  3. Open the /etc/rsyslog.d/45-test.conf file and replace the first paragraph with the following lines: 

    # File 1
    input(type="imfile"
          File="/var/log/wild*.log"
          Tag="my.app.wild:"
          Severity="info"
          Facility="local7"
          reopenOnTruncate="on"
          PersistStateInterval="1")

    Wildcards are supported at file level, not at directory level.

    • /var/log/applog*.log is valid.
    • /var/applog*/logfile.log is not valid.

    Subdirectories that match the wildcard are not processed.

    • If /var/log/applog-dir.log is a directory, it will not be processed.

    Wildcards do not work in polling mode.

  4. Restart rsyslog. You can now use wildcards for monitoring files.

Have we answered your question?

If not, please contact our technical support team via email by clicking the button below.

CONTACT US

PREVIOUS CentOS V5-6

NEXT Fedora