Log Insight 2.x: Automated Upgrade

If you are running multiple Log Insight instances or manage a Log Insight cluster you may be looking for a way to automate upgrades. Read on to learn a couple ways to achieve this today.


Below I list a couple ways to automate upgrades. Please note neither approach is supported by VMware and one is really unsupported. In addition, the scripts are examples of how to go about performing the upgrades, but proper checks should be put in place to ensure the automation works properly. You know the drill, proceed at your risk!


The only supported way to upgrade Log Insight today is through the UI. Through a series of cURL commands this can be achieved today. While the script below is not technically supported, since it mimics the supported directions it should work without issue. Note that the script below works on a node-by-node basis and does not support entering maintenance mode (which technically means it is unsupported for clusters). CREDIT: My colleague Chris Todd outlined the script below.

# variables
# get a session id
curl --insecure -c cookies https://$LI_FQDN/
# authenticate
curl --insecure -b cookies --data 'username=$LI_ADMIN_USERNAME&password=$LI_ADMIN_PASSWD&login=Login' https://$LIFQDN/login
# upload upgrade file
curl -v --insecure -b cookies -include \
   -F '_eventName=upgrade' \
   -F 'uploadPakFile=@$LI_PAK;type=application/octet-stream' \
   -H 'Expect:' \
# accept eula and start upgrade
curl --insecure -b cookies --data 'pakFileName=$LI_PAK&_eventName=startPakUpgrade' https://$LI_FQDN/upgrade


Another approach is to upgrade via the CLI. The advantage to this approach is that you can easily determine all the nodes that need to be upgraded and perform a cluster upgrade from one command (you could with cURL, but need to parse the cluster page). Note this script assumes you have SSH keys configured on your nodes, you could also use something like sshpass or expect to authenticate.

# variables
# get nodes
NODES=$(ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@$1 "grep \"daemon host\" \$(ls /storage/core/loginsight/config/loginsight-config.xml* | sort -k1.55n | tail -n 1) | awk '{ split(\$0,a,\"\\\"\"); print a[2];}'")
# upgrade nodes
for NODE in $NODES; do
   ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $LI_USERNAME@$NODE "/opt/vmware/bin/loginsight-pak-upgrade $LI_PAK"

© 2014, Steve Flanders. All rights reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top