Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: How can be disabled syslog-ng service at boot (Read 1249 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

How can be disabled syslog-ng service at boot


 Hello, i'm trying to stop syslog-ng service to run at boot. I don't want to remove the service but just make it to run at will only when i want to troubleshoot something that can happen to fail.

I just want when needed to 'sv start syslog-ng' or stop the service 'sv stop syslog-ng'

How this can be done as easiest possible? Tnx and have a great awesome day everybody ;)


Re: How can be disabled syslog-ng service at boot

Reply #2
> Hello, i'm trying to stop syslog-ng service to run at boot. I don't want to remove the service but just make it to run at will only when i want to troubleshoot something that can happen to fail.
 
You do realize that if your problem happens when syslog hasn't started, starting it will not do anything since syslog wasn't there to record the problem?
Having logs from the past is invaluable, some problems may only give a warning and then have consequences that get repeated without telling you anything.

Re: How can be disabled syslog-ng service at boot

Reply #3
 I'm not worried about disk space but disk wear. I' don't need logs over and over about same error with the cost of shrinking my ssd lifespan. I've heard about log rotation but i'm not very used to it so i've set a cronjob, everyday at 16:00 to simply clear those log files except pacman log. Even with that i'm still having 10-25 MB of logs/day.

I have apparmor that creates constant rather huge entries in my logs that are 100% benign. When i want to check system health i can start syslog-ng for an hour or whatever time then stop it an read logs.

I've thought another way of stopping syslog service with cronjob every hour or every 6 hours but i wanted to know if there's a way of manually start that service and not at boot.

 

Re: How can be disabled syslog-ng service at boot

Reply #4
> I'm not worried about disk space but disk wear.

I don't think it's that much in the grand scheme of things, especially considering how web browsers write tons of stuff to ~/.cache
Still if you're really worried about disk wear, one solution is to mount a tmpfs somewhere and tell syslog to store logs there.

> I have apparmor that creates constant rather huge entries in my logs that are 100% benign. When i want to check system health i can start syslog-ng for an hour or whatever time then stop it an read logs.

IIRC syslog has filtering capabilities.

Also https://wiki.debian.org/SSDOptimization#Mounting_SSD_filesystems

Re: How can be disabled syslog-ng service at boot

Reply #5
I don't think it's that much in the grand scheme of things, especially considering how web browsers write tons of stuff to ~/.cache
Still if you're really worried about disk wear, one solution is to mount a tmpfs somewhere and tell syslog to store logs there.
This is what I do with ~/.cache. Helps with disk wear I suppose but more importantly to me it's all cleared after every reboot and although there's a bit of a trade off due to it being rebuilt after reboots I believe it's faster afterwards, what with it being in memory. You need plenty of memory though.

@Surf3r If it's just the apparmor log that concerns you could try linking it to /dev/null. As you don't have rotation set up I don't see why that would not work. (Edit: Or just disabling it's logging in it's config file or setting the log file to /dev/null there if possible."

For the easiest way to start and stop the service you could put an alias in ~/bashrc.
eg I have
Code: [Select]
alias sx="startx"
to save myself four characters when I need to start X. Wow that's lazy  :D

Re: How can be disabled syslog-ng service at boot

Reply #6
>to save myself four characters when I need to start X. Wow that's lazy  :D

Don't worry I'm one step above:
Code: [Select]
alias l=ls

Re: How can be disabled syslog-ng service at boot

Reply #7
Yeah that's a cool idea but where to send that tmpfs or ~/.cache? On an external usb stick? Cos it has to be on different device not on the main ssd or hdd I assume.

Re: How can be disabled syslog-ng service at boot

Reply #8
Yeah that's a cool idea but where to send that tmpfs or ~/.cache? On an external usb stick? Cos it has to be on different device not on the main ssd or hdd I assume.
tmpfs goes in RAM

Your /tmp may already be tmpfs ?
from /etc/fstab
Code: [Select]
tmpfs                                           /tmp            	tmpfs   		nodev,nosuid,size=16G 
A similar line
Code: [Select]
tmpfs                                           /var/log            	tmpfs   		nodev,nosuid,size=16G 
Will mount /var/log as a tmpfs. IE in memory
This is the line that mounts my ~/.cache
Code: [Select]
tmpfs                                           /home/gripped/.cache 	tmpfs   		noatime,nodev,nosuid,size=28G
Big size because yay uses it and firedragon needs a lot of space to compile.
Only as much memory as is needed will be used. If it reserves any it isn't much. So with 32GB I can have multiple 16GB tmpfs and that's not an issue unless they all want to use it all at once. In which case you'd get 'out of space' errors

Re: How can be disabled syslog-ng service at boot

Reply #9
 All of the above solutions worth giving a try. But i remember once when i wanted to remove that neofetch to show its head just before startx kicked in. I had to add or better said change some rc file can't remember rn what file was. I think i just need to add at the right place 'sv stop syslog-ng' and the service simply will stop hopefully.  8)

Re: How can be disabled syslog-ng service at boot

Reply #10
I think i just need to add at the right place 'sv stop syslog-ng' and the service simply will stop hopefully.  8)
I don't use runit but from looking at the wiki
Code: [Select]
sv stop syslog-ng
does stop the service. But it would hardly be an elegant or efficient process to have the service started at boot to then be almost instantly stopped again in rc.local (if it exists in runit) or similar.
I just read on the wiki that you can disable a runit service by just having a file 'down' in the right place.
https://wiki.artixlinux.org/Main/Runit#Disable_service
Seems fairly simple. Why complicate things ?

Re: How can be disabled syslog-ng service at boot

Reply #11
@gripped  Yep that's the way to do it, the proper way. Can't understand how i skipped that piece of runit wiki  :o

Code: [Select]
 touch /run/runit/service/service_name/down

  However if i do it that way the downside is that the boot sequence will have no logs since it never starts while letting it run just for the boot sequence one of the most important part in case system won't boot i guess would be more useful. Now another thing i don't quite know is which part writes pacman log, it's syslog-ng or pacman takes care of that part? I still need my pacman logs just in case some package takes a dump so  can downgrade it..etc :)

Re: How can be disabled syslog-ng service at boot

Reply #12
pacman writes its own log in /var/log/pacman.log.

Though really, what you're doing is massively overengineered in comparison to just silencing apparmor, making /var/log a tmpfs or making syslog write to /run (which is RAM-backed and doesn't tax your SSD).

Re: How can be disabled syslog-ng service at boot

Reply #13
Hello, i'm trying to stop syslog-ng service to run at boot. I don't want to remove the service but just make it to run at will only when i want to troubleshoot something that can happen to fail.

I would use metalog.

https://wiki.gentoo.org/wiki/Metalog
https://github.com/hvisage/metalog

Code: [Select]
pacman -R syslog-ng
pacman -S metalog-runit
"Wer alles kann, macht nichts richtig"

Artix USE="runit openrc slim openbox lxde gtk2 qt4 qt5 qt6 conky
-gtk3 -gtk4 -adwaita{cursors,themes,icons} -gnome3 -kde -plasma -wayland "

Re: How can be disabled syslog-ng service at boot

Reply #14
That's an interesting light weight alternative. I saw it did not get an upgrade from quite some time, perhaps being such a small package but yeah worth giving it a try.