How to start a service by splitting the configuration without using Multiple Pipelines in logstash

Yusuke Hoshiba
1 min readMar 1, 2020

--

※I turned Japanese articles written in Qiita into English.

Japanese:https://qiita.com/henatyokotraveler/items/51ddbb26d84343d07b5d

Thing I want to do

In creating a mechanism to import various files into elasticsearch with logstash, I want to split the config file for readability.

If the logstash version is 6.0 or later,
You can use Multiple Pipelines ,
My environment is 5.6, so I tried it without using Multiple Pipelines.

Points to consider

I referred to the following. ※Japanese Site

Create unit definition file
Installation and disabling

# yum install logstash
### If it is already running, disable it below ###
# systemctl stop logstash.service
# systemctl disable logstash.service

Create unit definition file
① Make a copy of the original unit definition

# cp -p /etc/systemd/system/logstash.service /etc/systemd/system/logstash_hoge.service

②Create directory for path.data

# mkdir/etc/logstash/logstash_hoge

③Unit definition file

# vi /etc/systemd/system/logstash_hoge.service

Modify the following
- Description correction
- Change User and Group from logstash to root
- Added “ — path.data /etc/logstash/logstash_hoge”at the end of ExecStart

[Unit]
Description = logstash_hoge
[Service]
Type=simple
User=root
Group=root
# Load env vars from /etc/default/ and /etc/sysconfig/ if they exist.
# Prefixing the path with ‘-’ makes it try to load, but if the file doesn’t
# exist, it continues onward.
EnvironmentFile=-/etc/default/logstash
EnvironmentFile=-/etc/sysconfig/logstash
ExecStart=/usr/share/logstash/bin/logstash “--path.settings” “/etc/logstash” -path.data /etc/logstash/logstash_hoge
Restart=always
WorkingDirectory=/
Nice=19
LimitNOFILE=16384
[Install]
WantedBy=multi-user.target

Service registration

# systemctl enable logstash_hoge.service
# systemctl start logstash_hoge.service

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response