How to Change the Default Ports on Log Insight

By default, Log Insight is configured listen on the following ports:

  • UI: 80/443
  • Syslog: 514/1514/6514
  • CFAPI: 9000/9543

The question becomes, how do you change these default ports?
li-logo

WARNING: The following is not officially supported. Proceed at your own risk.

While the UI does not offer a way to change the default ports, you can from the CLI. You may be tempting to change the ports on the applications opening them. For example, you may try to change the ports on the Tomcat configuration, but your changes may be overridden by Log Insight. Instead, you can change the configuration of Log Insight. To do this, you need to create a new — actually updated — configuration on the master node and then restart each node starting with the master. The only information you need is the configuration section for the port(s) you wish to change. These configurations are as follows:

<ui>
    <webui-port value="9099" />
    <webui-secure-port value="9443" />
</ui>
<importer>
    <syslog-port value="514" />
    <syslog-ssl-port value="1514" />
    <syslog-ssl-second-port value="6514" />
</importer>
<api-server>
    <port value="9000" />
    <ssl-port value="9543" />
</api-server>

The actual steps would be (be sure to read the comments below):

PROJECTS=/storage/core/loginsight/config
CONFIG=$(ls $PROJECTS/loginsight-config.xml* | sort -k1.55n | tail -n 1)
NUM=$(echo $CONFIG | awk '{split($0,a,"#"); print a[2]}')
cp $CONFIG temp.xml
# change the below ports as desired
sed -i '/<\/config>/i \
    <ui> \
        <webui-port value="9099" \/> \
        <webui-secure-port value="9443" \/> \
    <\/ui> \
    <importer> \
        <syslog-port value="514" \/> \
        <syslog-ssl-port value="1514" \/> \
        <syslog-ssl-second-port value="6514" \/> \
    <\/importer> \
    <api-server> \
        <port value="9000" \/> \
        <ssl-port value="9543" \/> \
    <\/api-server>
<\/config>' temp.xml
mv temp.xml $PROJECTS/loginsight-config.xml#$NUM
service loginsight restart
# you must restart the LI service on all the workers as well
<restart_workers>

© 2015, Steve Flanders. All rights reserved.

Leave a Reply

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

Back To Top