[RHEL7 / CentOS7] I put in the log monitoring tool swatch and tried to notify by email

Installation

EPEL repository added

# rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

swatch installation

# yum install swatch --enablerepo=epel

setting file

When the string "action =" auth-logon "" is detected in the log file

--Display on screen --Email notification

# vi swatch_fwlog.conf

watchfor /action=\"auth-logon\"/
    echo
    [email protected],subject="[sslvpn] logon success"

Manual startup

# /usr/bin/perl /bin/swatch -c /root/swatch_fwlog.conf -t /var/log/fwlog &

Manual stop

#kill process number

Register with Systemd

Creating a unit file

# vi /lib/systemd/system/swatch_fwlog.service

[Unit]
Description=swatch for firewall log
After=syslog.target network.target postfix.service

[Service]
ExecStart=/usr/bin/swatch -c /root/swatch_fwlog.conf -t /var/log/fwlog --pid-file /var/run/swatch_fwlog.pid --daemon > /dev/null 2>&1
Type=forking
PIDFile=/var/run/swatch_fwlog.pid

[Install]
WantedBy=multi-user.target

Reflect

# systemctl daemon-reload

Automatic startup

# systemctl enable swatch_fwlog

Start-up

# systemctl start swatch_fwlog

Status check

# systemctl status swatch_fwlog

Stop

# systemctl stop swatch_fwlog

Consideration

--It is necessary to create a configuration file for each log file and execute swatch individually. --The corresponding line of the log is inserted in the body of the email notification

Recommended Posts

[RHEL7 / CentOS7] I put in the log monitoring tool swatch and tried to notify by email
I tried to illustrate the time and time in C language
I tried moving the image to the specified folder by right-clicking and left-clicking
I tried to verify and analyze the acceleration of Python by Cython
I implemented the VGG16 model in Keras and tried to identify CIFAR10
I tried to predict the change in snowfall for 2 years by machine learning
I tried to pass the G test and E qualification by training from 50
The first step to log analysis (how to format and put log data in Pandas)
I tried to graph the packages installed in Python
[Linux] I learned LPIC lv1 in 10 days and tried to understand the mechanism of Linux.
I tried to notify the update of "Become a novelist" using "IFTTT" and "Become a novelist API"
I tried to put pytest into the actual battle
I tried to put HULFT IoT (Agent) in the gateway Rooster of Sun Electronics
I tried to notify the honeypot report on LINE
I tried to verify the yin and yang classification of Hololive members by machine learning
I also tried to imitate the function monad and State monad with a generator in Python
I tried to put HULFT IoT (Edge Streaming) in the gateway Rooster of Sun Electronics
I tried to introduce the block diagram generation tool blockdiag
I tried to notify the train delay information with LINE Notify
I tried programming the chi-square test in Python and Java.
I tried to display the time and today's weather w
I tried to summarize the commands often used in business
I tried to implement the mail sending function in Python
I can't log in to the admin page with Django3
I tried to enumerate the differences between java and python
I tried to output the access log to the server using Node.js
I tried to make it possible to automatically send an email just by double-clicking the [Python] icon
I tried to find out the difference between A + = B and A = A + B in Python, so make a note
I tried to summarize the contents of each package saved by Python pip in one line
A story that didn't work when I tried to log in with the Python requests module
I tried fitting the exponential function and logistics function to the number of COVID-19 positive patients in Tokyo
I want to record the execution time and keep a log.
I tried to describe the traffic in real time with WebSocket
I tried to process the image in "sketch style" with OpenCV
Continuation: I tried to introduce the block diagram generation tool blockdiag
I tried to summarize the commands used by beginner engineers today
I tried to predict by letting RNN learn the sine wave
I tried to process the image in "pencil style" with OpenCV
I tried to solve the shift scheduling problem by various methods
I tried to log in to twitter automatically with selenium (RPA, scraping)
I tried to summarize all the Python plots used in the research by active science graduate students [Basic]
I tried to open the latest data of the Excel file managed by date in the folder with Python
I tried to make it possible to automatically send an email just by double-clicking the [GAS / Python] icon
I tried to move the ball
I tried to estimate the interval.
I want to change the color by clicking the scatter point in matplotlib
[Python] I tried to summarize the set type (set) in an easy-to-understand manner.
I tried to summarize until I quit the bank and became an engineer
I tried to visualize the age group and rate distribution of Atcoder
I tried to summarize the general flow up to service creation by self-education.
765 I tried to identify the three professional families by CNN (with Chainer 2.0.0)
I tried to implement Bayesian linear regression by Gibbs sampling in python
Matching karaoke keys ~ I tried to put it on Laravel ~ <on the way>
I tried Linux (CentOS 7) life and death monitoring (Ping) with monitoring server Zabbix
I tried to learn the angle from sin and cos with chainer
The file name was bad in Python and I was addicted to import
I tried to find the optimal path of the dreamland by (quantum) annealing
I tried to extract and illustrate the stage of the story using COTOHA
I tried fractal dimension analysis by the box count method in 3D
[Linux] I tried to verify the secure confirmation method of FQDN (CentOS7)
I tried to summarize the Linux commands used by beginner engineers today-Part 1-