2

If I have nxlog running on multiple IIS servers (say web1, web2, web3, web4). How can I add an identifier to the nxlog output which is being sent to logstash.

Then within logstash I want to create a custom index with the server identifier (ex %{server_id})

output { 
    elasticsearch_http { 
        host => "localhost" 
        port => 9200
        index => "%{server_id}-logstash-%{+YYYY.MM.dd}"
    }
}
Todd Smith
  • 200
  • 3
  • 8
  • I would suggest that you put all similar nodes into the same index. It will make it easier for you in Kibana. You can always put a Filter on to select a single. Otherwise, you would have to make sure you add all of the index patterns (web1-*, web2-* etc) to Kibana's configured list of indexes. – Cameron Kerr Apr 22 '15 at 11:55
  • I suggest that you ship the logs as JSON from NXLOG to Logstash, and try and standardise on JSON (where possible) as the preferred injestion format for entrance into Logstash. It gives you a cleaner way to add useful information from the client without adding complexity on the server-side. – Cameron Kerr Apr 22 '15 at 11:59

1 Answers1

1

In the Output element you are using to send to logstash, add:

   Exec $Hostname = '<ServerHostname>';
Sean Summers
  • 199
  • 1
  • 4