Logstash CPU utilization is high


(Mamta ) #1

Hi,
I am using logstash 6.2.4 version. When I try to run any conf file at that time CPU utilization is high. So currently there is no conf file is running but still, CPU usages are high. I have attached a screenshot of the top command.
Please guide us.


(Magnus Bäck) #2

No configuration file at all? Then Logstash might be in a crash loop since it won't start up properly but is constantly being restarted by systemd or whatever you're using. Make sure you have at least one configuration file.


(Mamta ) #3

Thanks for the reply.
But on other Redhat system, I have used logstash.conf file for apache logs. That time also my CPU utilization is high so we thought will setup ELK on ubuntu machine and will try without any logstash.conf file. I have attached my apache access log conf file.
conf


(Magnus Bäck) #4

How many events per second is it processing? The CPU usage is proportional to the event rate, so looking at the CPU usage in isolation isn't useful.


(Mamta ) #5

Events means particular conf file or process?


(Magnus Bäck) #6

I don't understand the question. How many events (log messages) are you processing per second?


(Mamta ) #7

At a time I am running only one log file.


(Magnus Bäck) #8

"just one file" doesn't answer the question "what's the event rate?".


(Mamta ) #9

Hey,

I have no idea how to check event rate? can you please give some command to check it?

Thank you


(Magnus Bäck) #10

Logstash's monitoring API should be able to help, or the metrics filter, or just manual measuring how long it takes to process a file with a given size. The exact figures aren't that important. If you're sending stuff to ES you'll probably get sufficiently good numbers if you just look at the time histogram of all events.


(Mamta ) #11

But right now I am not running any conf file but still cpu utilization is high.


(Magnus Bäck) #12

I repeat: No configuration file at all? Then Logstash might be in a crash loop since it won't start up properly but is constantly being restarted by systemd or whatever you're using. Make sure you have at least one configuration file.


(Mamta ) #13

There in a configuration file in /usr/share/logstash/bin directory. For logstash starting I am using systemctl restart/start logstash command.


(Magnus Bäck) #14

When run in that manner it most likely is looking for config files in /etc/logstash/conf.d.


(Mamta ) #15

Path is matter for cpu usage?


(Magnus Bäck) #16

No, the CPU usage isn't affected by the location of your configuration files.


(Mamta ) #17

Hey Magnusbaeck,

Thank you for all your suggestion till yet.
I have kept a conf file in /etc/logstash/conf.d directory but still my conf file is not running after systemctl restart logstash command. CPU usage is still going high.


(Magnus Bäck) #18

If you increase Logstash's logging verbosity it'll log exactly which configuration it loads (and more about what it does in general).


(Mamta ) #19

Hey Magnusbaeck,

Sorry, but I am not getting what you want to say. I have just started ELK learning and setup.
Please give some command or what changes is required in yaml file?


(Magnus Bäck) #20

Change the log.level setting in logstash.yml, see https://www.elastic.co/guide/en/logstash/current/logstash-settings-file.html.