Collating syslogs in an enterprise environment is incredibly useful. You can get a great overview of all of the activity across your services, easily perform audits and quickly find faults.
I played with Splunk a while ago, and whilst amazingly easy to deploy and configure, it is still paid software after a point. To go down the free path instead, one of the best alternatives is the ELK stack (Elasticsearch, Logstash, Kibana).
It took me a little while to get a fully functioning system going. It’s easy to install the service, but it does take a little bit of time to work out how to get data flowing into it. Thankfully in the latest version of ELK some additional products, called beats, are provided for cross-platform data collection. And the product documentation has been improving quite a lot.
My favourite beat is topbeat, which gathers performance metrics from your machine to publish to ELK, so there’s a bit of crossover with other monitoring tools (like Nagios) but you get awesome graphs showing system usage over time. It’s also fascinating how much packetbeat can see of all the web and DB traffic on hosts. It’s seriously addicting just trying to see how much data you can get pushed into ELK from your network, even if you’re not going to probably use all of it.
# take the output of the above statement to your local Certificate Authority for signing, then put it into the following file: vi /etc/pki/tls/certs/logstash-forwarder.crt
Install Nginx
Nginx will be used to present the Kibana site on standard HTTP ports.
In addition, if you’re bringing in windows logs you can load the winlogbeat.template.json from the Winlogbeat installer in the same way as above, you just need to use SCP or another method to get the template file onto the server.
1 2
# Install Index Templates curl -XPUT 'http://localhost:9200/_template/winlogbeat?pretty' -d@/tmp/winlogbeat.template.json
Rebranding
If you’re into rebranding of the product, you can swap out the logo and favicon with your own just by doing the following (after uploading the files to /tmp):
# Install the packages yum install filebeat topbeat packetbeat -y
# Add the ca certificate that signed the logstash certificate cat <<EOF > /etc/pki/tls/certs/logstash-forwarder.crt -----BEGIN CERTIFICATE----- <certificate data> -----END CERTIFICATE----- EOF
# Install the packages yum install filebeat topbeat packetbeat -y
# Add the ca certificate that signed the logstash certificate cat <<EOF > /etc/pki/tls/certs/logstash-forwarder.crt -----BEGIN CERTIFICATE----- <certificate data> -----END CERTIFICATE----- EOF
# Enable and Start the services chkconfig filebeat on chkconfig topbeat on chkconfig packetbeat on service filebeat start service topbeat start service packetbeat start
Ubuntu Client Machines
The nice thing is the configs stay pretty much the same across platforms, here’s Ubuntu:
# Add the ca certificate that signed the logstash certificate cat <<EOF > /etc/pki/tls/certs/logstash-forwarder.crt -----BEGIN CERTIFICATE----- <certificate data> -----END CERTIFICATE----- EOF
# Start the Services service filebeat start service topbeat start service packetbeat start
Windows Client Machines
Finally here’s what I did for enabling my Windows servers to start logging. It involves installing the winlogbeat on top of any other beats you want (I’ve got filebeat here):
####################### ## Install the Beats ## ####################### PS C:\Program Files\Winlogbeat> .\install-service-winlogbeat.ps1 PS C:\Program Files\Topbeat> .\install-service-topbeat.ps1 net start winlogbeat net start topbeat
Now you should have a nice stream of data coming in for viewing with Kibana. I won’t go into setting up dashboards and the like with the product, as I find it’s just easier to play with it yourself and work out what you want to be monitoring.