Commit graph

128 commits

Author SHA1 Message Date
Andres Rodriguez
a1166cc9ba
Fix system unit TimeoutStopSec on older version. (#14947)
Fixes the system unit TimeoutStopSec option to set 0 on older version that do not support 'infinity'.
Also handles the upgrade case where the OS may not automatically upgrade the systemd file.
2023-03-31 14:38:11 -04:00
Andres Rodriguez
303fdb0193
Only remove /etc/s/s/logstash.service if previously installed by Logstash (#14200)
During upgrade, Logstash packaging removes /etc/systemd/system/logstash.service because Logstahs used to install the systemd unit there. However, this could have been modified by the user by overriding the systemd file. As such, the upgrade process should only remove if it is certain it wasn't installed by Logstash.

Unfortunately, there's no particular way to determine if Logstash installation process installed the file because it was done on the fly, by a script, on a postinst script of the package.

As such, the best way to address this is to check if both the new and the old file exists. If the new one doesn't exist, we can assume we are upgrading (or installing afresh), and the old file should be removed. If the new one exists and the user-create one (old location) also exists, we assume it is user created, and as such, we don't remove it just to be safe.
2022-06-24 10:56:07 -04:00
Andres Rodriguez
01fd474dc1
Fixes centos-7 package init scripts
Fixes the CentOS package installation to ensure that if both the systemd unit and sys-v init script are installed, the “service” command  a prefers systemd.
2022-03-22 20:07:55 -04:00
Andres Rodriguez
38fbe5aa0f
Remove pleaserun (via bin/system-install) usage (#12415)
This change removes the usage of 'pleaserun', which
was leveraged create the init.d scripts or systemd units.

Now, we ship init.d scripts and systemd units to make
the maintenance easier and following the lead of the
other Elastic projects.

Fixes: #10519, Fixes: #12439, Fixes: #8253
2022-03-10 12:11:41 -05:00
Andres Rodriguez
c4cb8f4f12
Set correct permissions for /usr/share/logstash on pkg installs (#12782)
This PR sets correct ownership of /usr/share/logstash on DEB & RPM installs, following FHS guidelines.

Closes: #12771
2021-03-31 12:21:48 -04:00
Dan Hermann
d6e730f9b6 Unify logging properties across distributions.
Fixes #9006, #8499.

Fixes #9076
2018-03-29 18:55:27 +00:00
Jake Landis
9841f7bf67 Ensure that environment variables are only accessible to be read root
Part of #8735

Fixes #9006
2018-01-24 16:43:37 +00:00
Jordan Sissel
e120906673 Use multiple pipelines feature by default in RPM and Debian packages.
This change keeps the previous behavior but implements it using multiple
pipelines (pipelines.yml) instead of with `path.config`.

* The default pipeline name is still "main"
* Default config path is still /etc/logstash/conf.d/*.conf

Other small changes included:
* Specify fpm workdir. Otherwise rpmbuild is given an empty value for
  its temporary directory. It's unclear if this is a bug in fpm or in my
  environment, but I like the change anyway to put fpm's build activity
  in the build directory.
* DRY's up the common files going in /etc/logstash for both rpm and deb
  packages.

For #8893

Fixes #8894
2018-01-10 19:04:38 +00:00
Suyog Rao
cfecf81091 Only glob *.conf by default in conf.d folder (#7130)
* Only glob *.conf by default in conf.d folder

Fixes #6979, Fixes #1831
2017-05-19 11:26:10 -07:00
Jordan Sissel
441eb84d4d Truncate from the end of the message instead of the front.
PatternLayout calls this 'left justify' I think.

Fixes #6255

Fixes #6258
2016-11-15 18:39:15 -05:00
Suyog Rao
f3f3e14432 Remove logrotate references since it's not used
Fixes #6028

Fixes #6029
2016-10-11 16:01:43 -04:00
Suyog Rao
0a59592fe8 Use format for log file
Fixes #5903
2016-09-13 19:39:27 -04:00
Suyog Rao
b81ea2ec24 Use latest props from master
Fixes #5903
2016-09-13 19:39:27 -04:00
Suyog Rao
0826c1eb30 Remove console logging for services
Fixes #5903
2016-09-13 19:39:27 -04:00
Suyog Rao
c01a3df235 add package specific log4j2 logging props
Fixes #5894

Fixes #5903
2016-09-13 19:39:26 -04:00
Tal Levy
61ebeb0b4b update path.log to path.logs directory, and respect it in log4j2
Fixes #5876
2016-09-08 18:06:30 -04:00
Daniel Riegel
f8739018ab Update after-install.sh - fix log file permissions (#5737)
Update after-install.sh - fix log file permissions

When installing Logstash (after previous removal of the Logstash RPM), there is a chance that there are old log files without proper owner.
Running Logstash as service, it may want to append data to these log files. Consequently, the logstash service does not start because it doesn't have write permissions to that files. This patch sets the (new) user logstash to own these historic files.
2016-08-09 08:27:05 -07:00
Joao Duarte
c0c9a3babc add data.path setting
Fixes #5528
2016-06-24 07:32:25 -04:00
Joao Duarte
645eee4a70 avoid using duplicate logstash.yml for rpm/deb
Fixes #5537
2016-06-22 14:10:18 -04:00
Aaron Mildenstein
58b1c5386a Fix starting logstash from command-line
This fix is for packages only (RPM/DEB)

This puts the requisite changes into /etc/logstash/logstash.yml so that starting logstash from the command-line, e.g. `/usr/share/logstash/bin/logstash --path.settings /etc/logstash` will read the pipeline from `/etc/logstash/conf.d` and log to `/var/log/logstash/logstash.log`.

fixes #5379

Comment out tmpdir in jvm.options

The absence of the tmpdir can cause JRuby to fail

Fixes #5383
2016-05-27 21:03:12 +00:00
Aaron Mildenstein
e40ecbb6b8 Update existing packaging to use /usr/lib/logstash
Update after-install scripts

Use /usr/lib/logstash instead of /opt/logstash

More revisions.

Using `/usr/share/logstash` instead of `/usr/lib/logstash`

Track these new files

More work in progress.

Proper arg parsing obtained

WIP: Use jvm.options like ES

Remove facter dependency

Due to an update from @jordansissel on pleaserun, facter is no longer necessary

Revert Gemfile to proper version

Latest work in progress.

I added a simple test to logstash.lib.sh to catch empty strings in java options.

Added `startup.options`, and touched up `jvm.options`

Edited the package scripts to make things play nice with new paths.

Tweaked `system-install` to allow users to provide their own `startup.options` file.

Patch up merge failure

Changes to work with the new logstash.yml

Add fpm dependency (build fails without it)

Fix missing gems in Gemfile

Don't know how these got lost

Use /etc/logstash for configuration in packages

Update the instructions/documentation for...

...startup.options

Merging proposed changes

Remove mustache and clamp

They're covered by pleaserun anyway

Prune config dir from /usr/share/logstash...

...but only when using RPM/DEB packages

Fixes #5341
2016-05-25 17:25:26 +00:00
Cheyenne T. Greatorex
869fcd24d4 bug fix, changed == to =
Fixes #5202
2016-04-26 19:12:59 +00:00
Cheyenne T. Greatorex
e7c05f9c0f Fixed force kill variable name, added a default setting for it, and added code to the stop function to handle inability to stop when not forcing
Fixes #4991, #5168
2016-04-22 18:45:44 -07:00
CSJ
ad40284913 remove "agent" words
since “agent” is not valid argument now, remove them to be consistent.

Fixes #5083
2016-04-15 17:35:31 +00:00
CSJ
4582706331 remove unnecessary argument
fixed “ERROR: too many arguments” when start log stash daemon

Fixes #5083
2016-04-15 17:35:31 +00:00
skokhanovskiy
99461fceff add reload support to the init script
Fixes #5088
2016-04-13 17:15:26 +00:00
Pere Urbon-Bayes
e8f817bd01 fix package stop function to use proper portable [ command insted of the bash [[ based one when trying to kill an stale instance
Fixes #4992
2016-04-04 18:10:03 +00:00
Will Bradley
e6ba46d9fa spacing
Fixes #4732
2016-03-11 20:28:58 +00:00
Will Bradley
32616311b9 Handling undefined $KILL_ON_STOP_TIMEOUT
In cases where $KILL_ON_STOP_TIMEOUT is undefined, getting to line 99 will generate the following error:

```
/etc/init.d/logstash: line 99: [: : integer expression expected
```

I'm no shell scripting expert, but from some tinkering I landed upon changing

```
if [ "$KILL_ON_STOP_TIMEOUT" -eq 1 ] ;
```

to

```
if [[ $KILL_ON_STOP_TIMEOUT -eq 1 ]] ;
```

which appears to work for me.

Also, logstash often takes longer than 5 seconds to shut down for me, so adding a few more seconds to the countdown on line 93 might help.

Might fix https://github.com/elastic/logstash/issues/4457

Fixes #4732
2016-03-11 20:28:58 +00:00
Suyog Rao
8291ddd0a7 Fix configtest option in init scripts
No need to export all the JAVA* related environment variables
for configtest. It needs a minimal set of variables to execute
bin/logstash --config-test. This was indirectly causing issues
when used with JMX options in LS_JAVA_OPTS. JMX needs a remote port defined
and configtest was trying to connect to the port twice which caused
restart (#4319) to fail

Fixes #4319

Fixes #4759
2016-03-04 19:04:51 +00:00
Siddhartha Sahu
8bf1839b0d Use the new LS_GC_LOG_FILE variable in init scripts
Follow up to pull request #4718

Fixes #4733
2016-02-29 19:40:27 +00:00
Aaron Mildenstein
b7fa3fac23 Fix order of --configtest arg
It should come before the `-f`, otherwise Logstash might bind a port and
start running, rather than only perform a configtest, then exit.

fixes 4737

Fixes #4738
2016-02-29 17:32:16 +00:00
Suyog Rao
c136d58d32 Set LS_HEAP_SIZE correctly to 1g
Previously we had set heap size to 1g in a few places, but not everywhere

Fixes #4550
2016-01-22 17:17:34 +00:00
Suyog Rao
57f3bedd8d init: Remove overwrite of JAVA_OPTS
Fixes #4517

Fixes #4518
2016-01-21 17:34:07 +00:00
Robert Neumayer
e390d105e4 Fix configtest in sysv init script
Replace non-existing log function with echo.
Replace "exit 1" with "return 1" to make quiet function work.

Fixes #4321
2015-12-15 02:32:18 +00:00
Aaron Mildenstein
e60f4d67bd Rotate .err and .stdout files too
As suggested in #1574, rotate the logstash.err and logstash.stdout
files also.

Fixes #4136
2015-11-04 17:29:02 +00:00
Aaron Mildenstein
65a5996187 Fix logrotate file perms for Debian systems
In some cases it seems that the file permissions for the logrotate
configuration file are not set properly. This should address those
cases.

Fixes #4136
2015-11-04 17:29:02 +00:00
Aaron Mildenstein
eec80944f9 Fix logrotate permissions after install
In some cases it seems that the file permissions for the logrotate
configuration file are not set properly.  This should address those
cases.

fixes #3490

Fixes #4135
2015-11-04 17:28:33 +00:00
ThomasdOtreppe
841b876778 Add configcheck to init and make sure to check config before restarting
Fixes #3645
2015-10-30 19:55:06 +00:00
Jordan Sissel
ed27fe1b68 Use echo instead of trace or emit.
This should fix a test failure on CentOS 6 where 'emit' gives 'command
not found' which, as the last command run in stop(), causes stop() to
always return exit code 127.

Fixes #3614
2015-07-16 02:21:58 +00:00
Aaron Mildenstein
00cf4d906c Manually merge changes to pleaserun
See https://github.com/jordansissel/pleaserun/pull/86

Fixes #3609
2015-07-14 20:26:08 +00:00
CoolAcid
0288697219 Use linux command id to get the list of groups - supports nss and pam
Fixes #1398
2015-07-06 23:44:41 +00:00
CoolAcid
de8bcd2a7c Take into account if there are not extra groups
Fixes #1398
2015-07-06 23:44:41 +00:00
CoolAcid
01cea40a9b Fix for chroot not getting supliemental groups
Fixes #1398
2015-07-06 23:44:41 +00:00
Jordan Sissel
17e5f27ed9 Remove pkg/build.sh as it was old and unused.
Fixes #1735

Fixes #3345
2015-05-29 20:08:03 +00:00
Aaron Mildenstein
b26f2fc55e Fix permissions after install
/etc/logstash was getting 775 perms in the debian package.

This manually sets 755 to /etc/logstash

fixes #3305

Fixes #3331
2015-05-27 21:10:42 +00:00
Pere Urbon-Bayes
193765ced2 adapt the lib.sh file to the use case proposed LS_JAVA_OPTS add to defualts while JAVA_OPTS override
updated the packaged to enable JAVA_OPTS to override the defaults

ammended JAVA_OPTS being exported

ammend warning wording

ammend the last commit

fix wording again

Fixes #2942
2015-04-17 13:49:19 +00:00
Pere Urbon-Bayes
cbaadb16f2 make the LS_JAVA_OPTS environment variable available to the client side, so the user is not force to use the default ones and they can rewrite it
remove stale code

cleanup the bash conditions for when a variable is defined or not

make sure LS_JAVA_OPTS override JAVA_OPTS when need

ammend unused var

rollback to previous use case of appending vars to JAVA_OPTS in the case of having LS_JAVA_OPTS

Fixes #2942
2015-04-17 13:49:19 +00:00
Aaron Mildenstein
3986158bac First pass at cleaning out logstash web
All internal references, flags, kibana, vendor, everything must go!

If it referenced kibana or logstash-web, it is deprecated, and removed!

Operators are standing by...

Fixes #2661
2015-02-20 22:53:18 +00:00
Zhanpeng Chen
40665f02d6 fix nologin path
Fixes #2283
2015-01-05 22:55:02 +00:00