# CentOS & RHEL Log Integration

**CentOS & RHEL**

**Log Integration Guide**

**Log Integration procedure:**\
\
Follow these steps to configure log forwarding to a remote syslog server.

1. Install syslog package if you haven’t installed it.

`#yum -y install rsyslog`

1. Checking the rsyslog.conf

Open a rsyslog.conf file located at /etc/rsyslog.conf by following command.

`vim /etc/rsyslog.conf`

At the end of the file check for the following line and uncomment

\#Include all config files in /etc/rsyslog.d/

`$IncludeConfig /etc/rsyslog.d/*.conf`

<figure><img src="https://2078222076-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMRHZBPHlLDUc8519fX%2Fuploads%2FJBrKeuRUPHiDo3WAbD53%2Fimage.png?alt=media&#x26;token=d1109ab2-779b-40b5-9341-76dc9ac0d2bb" alt=""><figcaption></figcaption></figure>

Add below line at end of the file.

`*.* @<Log Collector IP>:12514`

<figure><img src="https://2078222076-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMRHZBPHlLDUc8519fX%2Fuploads%2FrfeIF8Zq7uPwjPR3OMPm%2Fimage.png?alt=media&#x26;token=3cacf47f-0294-4df1-bfcc-65b0c035b4d2" alt=""><figcaption></figcaption></figure>

Note: 514 port is the syslog default port number. Please replace 514 with blusapphire shared port number and provide log collector private IP.

Save and quit the configuration file.

Create log configuration for Audit logs with vim /etc/rsyslog.d/auditlog.conf and paste following lines below:

`$ModLoad imfile`

`auditd audit.log`

`$InputFileName /var/log/audit/audit.log ##path of log file`

`$InputFileTag tag_audit_log:`

`$InputFileStateFile audit_log`

`$InputFileSeverity info`

`$InputFileFacility local6`

`$InputFilePollInterval 1`

`$InputFilePersistStateInterval 1`

`$InputRunFileMonitor`

`$WorkDirectory /var/lib/rsyslog`

`$ActionQueueFileName fwdRule1 # unique name prefix for spool files`

`$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible)`

`$ActionQueueSaveOnShutdown on # save messages to disk on shutdown`

`$ActionQueueType LinkedList # run asynchronously`

`$ActionResumeRetryCount -1`

`local6.* @<Log Collector IP>:12514`

<figure><img src="https://2078222076-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMRHZBPHlLDUc8519fX%2Fuploads%2F6xBaipp4TKHUfSX4Mfnz%2Fimage.png?alt=media&#x26;token=0b05f7a2-efe1-4cf8-884e-d81f9b0e615f" alt=""><figcaption></figcaption></figure>

Save and Quit the configuration file.

Navigate to the following directory /create a file using the below command and paste the entire content of the file (all lines) from the git

`#vim /etc/audit/rules.d/audit.rules`

<https://github.com/Neo23x0/auditd/blob/master/audit.rules>

save and quit the file.

Restart rsyslog service

`sudo systemctl restart rsyslog`

`sudo systemctl status rsyslog`

<figure><img src="https://2078222076-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMRHZBPHlLDUc8519fX%2Fuploads%2FSl1idaEhFBC3sUcDgqFQ%2Fimage.png?alt=media&#x26;token=25d9f3ab-9145-41be-ab38-f9f2cf9c735e" alt=""><figcaption></figcaption></figure>
