Solution: rsyslog + loganalyzer cannot display IP addresses and host names simultaneously (original)

Source: Internet
Author: User
Tags rsyslog

Environment:

*********************

Adiscon LogAnalyzer Version 3.4.3

[Root @ cento100 ~] # Cat/etc/issue

CentOS release 5.6 (Final)

*********************

Some people may despise the title. The answer is nothing more than creating a view and creating DBMappings. I am very responsible to tell you, no. Here is how to modify the PHP source code. Let's talk a little bit about it.

Recently, rsyslog + loganalyzer has been used to implement centralized log management. However, after installation, only the host name is displayed and there is no IP address. I have found some articles on the Internet for reference, or I can only display IP addresses, either display only the host name, or both display the view to be added at the same time. When adding the view, I found that there cannot be multiple fields. So I thought about modifying the database. After modifying the database, I found that it was still incorrect.

Adding the first field is normal.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/1TZ12451-0.jpg "/>

When I added the second field, I was surprised to find out, FUCK, what is the situation of this mud horse?

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/1TZ11245-1.jpg "/>

Why does the first field become an Array? Muma, it's not even useful if it's called the yaja dish. If you add more, overwrite them one by one. Wool?

I was trying to fix this BUG. I also read PHP for a few days and thought it could be done by an old man. The results showed that it was really a huge job. When learning MVC, I didn't learn it well. I directly modified view. php and it seems that it would be aborted. But you cannot give up. The result is that you want to modify its own view and find the following:

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/1TZ15G5-2.jpg "/>

 

Black, black. If it is black, it means no change is allowed. Sister's, I can't understand the source code of view. php. Will the difficulty be the same as the tragedy? So I found out where to change the page and found that the page is still view. php, found that there is no such view, it itself has included a bunch of php, mud Ma, watch the egg pain, the more it hurts, the more you need to decide. Use grep directly in linux

 
 
  1. [root@centos100 log]# grep 'Syslog Fields' ./ -r 
  2. ./include/functions_config.php:                                                                 'DisplayName' =>"Syslog Fields", 

Compile it after finding it

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/1TZ135T-3.jpg "/>

Add content in the red box.

After that, I found that this field is still unavailable, because when I clicked to DBMappings, I found that there was no such field at all, and I had to change a file to implement the link.

 
 
  1. [root@centos100 log]# grep 'MonitorWare' ./ -r 
  2. ./classes/msgparsers/msgparser.eventlog.class.php:      public $_ClassDescription = 'This is a parser for a special format which can be created with Adiscon Eventreporter or MonitorWare Agent.'; 
  3. ./include/constants_logstream.php:$dbmapping['monitorware']['DisplayName'] = "MonitorWare"; 
  4. ./include/functions_config.php:                         $mysource['ObjRef']->DBTableType = "monitorware"; // Convert to MonitorWare! 
  5. ./include/constants_general.php:// --- MonitorWare InfoUnit Defines | Messagetypes 
  6. ./doc/install.html:     MonitorWare Line of products.</P> 
  7. ./doc/install.html:     MonitorWare Line of products.</P> 
  8. ./doc/install.html:LogAnalyzer supports Adiscon's MonitorWare database schema. The schema 
  9. ./doc/manual.html:<a href="http://www.mwagent.com">MonitorWare Agent</a>. 
  10. ./doc/windowsevent.html:<a href="http://www.mwagent.com">MonitorWare Agent</a> software. These Agents are 
  11. ./doc/basics.html:For the database, tabels in either MonitorWare format or the format used by 
  12. ./doc/basics.html:you set up something new, be sure the use MonitorWare schema. If you use 
  13. ./doc/basics.html:that rsyslog uses MonitorWare schema by default, too. So you probably need not to 
  14. ./doc/basics.html:<a href="http://www.msagent.com/">MonitorWare Agent</a> 
  15. ./doc/basics.html:<a href="http://kb.monitorware.com">MonitorWare Knowledge Base</a> to aid you 

The result is one by one. If the html is not found one by one, I will find the result./include/constants_logstream.php.

It is an array, and a new one is added to the result.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/1TZ14017-4.jpg "/>

 

Add the content of row 352.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/1TZ139D-5.jpg "/>

The IP address and host name are displayed.

Of course, before doing the above operations, you must insert this field in the database so that it can be displayed.

 
 
  1. mysql> USE Syslog; 
  2. mysql> ALTER TABLE SystemEvents ADD FromIP VARCHAR(60) DEFAULT NULL AFTER FromHost; 

Modify the log configuration file

 
 
  1. # vi /etc/rsyslog.conf 
  2. $template insertpl,"insert into SystemEvents (Message, Facility, FromHost, FromIP,Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values ('%msg%', %syslogfacility%,'%HOSTNAME%', '%fromhost-ip%', %syslogpriority%, '%timereported:::date-mysql%', '%timegenerated:::date-mysql%', %iut%, '%syslogtag%')",SQL 

After the preceding changes, you must add FromIP to the existing fields.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1TZ11505-6.png "border =" 0 "alt =" "/>

 

Do not forget to restart the rsyslog service.

 

Note:

Adiscon LogAnalyzer Version 3.6.3 has fixed the BUG where multiple fields cannot be added when adding a view. I am available for new tests.

3.6.3 if you want to display the IP address and host name at the same time, you must modify the IP address and host name differently.

 

 

This article is from the blog, please be sure to keep this source http://gm100861.blog.51cto.com/1930562/1187180

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.