Monitor logs on geo location basis

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
Thanis
Posts: 17
Joined: Wed Nov 01, 2017 3:53 am

Monitor logs on geo location basis

Post by Thanis »

Hi,

we have configured the cisco devices to push syslog to Nagios Log server as per the steps recommended.
Successfully , we are receiving the logs generated by the devices.

Instead of the host ip. we would like to view hostname in the UI for the ip's. what should we need to do ?

Moreover , we would like to monitor (dashboard) log on entity (or) location basis. for example floor wise or building wise

Please give us the solution to configure geoip, geoip.location wise to view the output
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Monitor logs on geo location basis

Post by mcapra »

Filters are the general answer to all of these use cases. Here is a primer on what filters are and how to configure some simple ones:
https://assets.nagios.com/downloads/nag ... ilters.pdf

Thanis wrote:Instead of the host ip. we would like to view hostname in the UI for the ip's. what should we need to do ?
A dns filter rule can do this, assuming all of your Nagios Log Server instances can properly reach your DNS server(s). Here's a thread where that is implemented:
https://support.nagios.com/forum/viewto ... 37&t=40770

And here's the very basic filter rule:

Code: Select all

dns {
    reverse => [ "host" ]
    action => [ "replace" ]
    add_tag => [ "dns" ]
}
This will replace the host field in all of your messages, converting it from an IP address to a DNS resolved hostname.
Thanis wrote:Moreover , we would like to monitor (dashboard) log on entity (or) location basis. for example floor wise or building wise
Without knowing exactly how you're identifying what floor/building a given machine's hostname/address is located in, I can't offer specific advice. You could leverage conditional mutate filters and tagging to, based on the hostname/address, flag messages with specific metadata.

In pseudocode, and assuming you had already figured out how to identify the specific building and floor a message came from, here's a filter rule that tags the 12th floor of the west building as "accounting":

Code: Select all

if [building] == 'west' and [floor] == 12 {
    mutate {
        add_tag => [ "accounting" ]
    }
}
Or, instead of tagging, you can leverage an entirely new field by using the add_field setting of the mutate filter. Perhaps something like "department" as the name and "accounting" as the value in the above case.
Thanis wrote:Please give us the solution to configure geoip, geoip.location wise to view the output
Here's a very basic filter rule that applies a geoip filter to the ip field:
https://support.nagios.com/forum/viewto ... 33#p173280

Your actual field name that contains the ip address might be named something other than ip though, like host. The filter will be slightly different depending on which field holds the ip address.
Former Nagios employee
https://www.mcapra.com/
Thanis
Posts: 17
Joined: Wed Nov 01, 2017 3:53 am

Re: Monitor logs on geo location basis

Post by Thanis »

Many thanks for your reply, will try tomorrow and let you know.again thanks for your guidance.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Monitor logs on geo location basis

Post by cdienger »

Please let us know your results after you've had a chance to test : )
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Thanis
Posts: 17
Joined: Wed Nov 01, 2017 3:53 am

Re: Monitor logs on geo location basis

Post by Thanis »

cdienger wrote:Please let us know your results after you've had a chance to test : )
I have followed the DNS Filter Rule but it doesn't change ip to hostname.

I have checked nslookup PF output below
--------------------------------------------------------------------------------
Output
[root@CQ218MAA ~]# nslookup 10.24x.xx.xxx
Server: 10.2x4.xx.1x
Address: 10.2x4.xx.1x#53

** server can't find xxx.xx.24x.10.in-addr.arpa.: NXDOMAIN
---------------------------------------------------------------------------------
So, I resolved ip locally on adding line in /etc/hosts file. As of now I used two hosts to resolve.
the below picture depicts host report and queried output

Here, I would like to change the IP to hostname. even I tried the dns filter rule. which doesn't work out.
As per the report picture (1.PNG) you could find both ip and hostname in bracket after I resolved locally.
but at the same time when I look at dashboard and filtered query it show "ip" in host field.
Please provide the solution.advance thanks
You do not have the required permissions to view the files attached to this post.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Monitor logs on geo location basis

Post by cdienger »

The DNS filter requires a dns sever that is able to do reverse lookups to get the hosts' IP address and a /etc/hosts entry will not work for this. The unique hosts works differently.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Thanis
Posts: 17
Joined: Wed Nov 01, 2017 3:53 am

Re: Monitor logs on geo location basis

Post by Thanis »

Thanks for your reply let me try and let you know

And have you got any document to configure Cisco switch to send it's geoip or geoip location to
NLS.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Monitor logs on geo location basis

Post by cdienger »

We don't have anything specific to that, but adding fields will likely cause it to break syslog format and require custom filters to have the logs parsed properly. Check out the logstash section at https://support.nagios.com/kb/article/n ... ew-98.html which has details on how this can be done.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Monitor logs on geo location basis

Post by mcapra »

cdienger wrote:We don't have anything specific to that, but adding fields will likely cause it to break syslog format and require custom filters to have the logs parsed properly.
And to be clear, this is not a problem that is specific to Nagios Log Server. Certain network device vendors (like Cisco) take liberties with the syslog protocol.
Former Nagios employee
https://www.mcapra.com/
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Monitor logs on geo location basis

Post by cdienger »

mcapra wrote:
cdienger wrote:We don't have anything specific to that, but adding fields will likely cause it to break syslog format and require custom filters to have the logs parsed properly.
And to be clear, this is not a problem that is specific to Nagios Log Server. Certain network device vendors (like Cisco) take liberties with the syslog protocol.
Absolutely. Thanks for the clarification :)
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked