Answer the question
In order to leave comments, you need to log in
What is the best way to parse messages?
The task is to display
information about user authorization from /var/log/messages. Further it is necessary to write down all this business in a database for example Mysql. Then bring it up to the software.
That is, you need an analogue of Windows logs.
Experienced advice needed. What is the best way to do this?
Make a parser for example in BASH? Or are there any ready-made solutions?
SUSE Linux Enterprise Server 11
Answer the question
In order to leave comments, you need to log in
awk is
responsible for parsing text files in linux .
There is a good book .
The task is not completely clear.
To display information from /var/log/messages, just do the following:
Specify the task.
Perhaps this approach will work for you. In /etc/syslog.conf add the line:
Then you will get the required information in the secure log file
tail -f /var/log/messages | grep "че вам нужно"
- and you get a live log only for this line
if you need to write it down
If you need to write all this to the database, then who is stopping you from writing to it.
mysql -uroot -pтут_парол << EOF
Тут что нужно записать
EOF
> Next, you need to write the whole thing to a database, for example Mysql
google://syslog-ng mysql
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question