from /var/log/messages I see many lines as the following:

   Oct  9 10:01:14 Linux_machine15 syslog-ng[14736]: Error opening file for writing; filename='/var/log/remote/', error='Too many open files (24)'

I need to understand what is the meaning of the "Too many open files (24)" messages ?

 more /etc/security/limits.conf

 *       soft    nofile  8192
 *       hard    nofile  65536
 *       soft    nproc   8391
 *       hard    nproc   16384

The operating system sets limits, how many open files a process is allowed to have. These limits are usually set in /etc/security/limits.conf.

By default, the limit for open files might be too low, sometimes as low as 1024.

You can increase the limits globally by adding:

*          -       nofile          16384

You can also set the limits per user or per group, by replacing the asterisk in the first column by username, or by @groupname.

| improve this answer | |
  • just to clarify this - you mean when we write on the same time for example to 2000 files , then OS have limitation about to write to these files ? – yael Oct 9 '16 at 11:19
  • @yael - the limit is for open files, ie for file descriptors. Regardless whether you open them for writing or reading only. – 400 the Cat Oct 9 '16 at 11:39
  • so what is the number - 24 in the log? – yael Oct 9 '16 at 11:41
  • 2
    @yael - the number 24 has nothing to do with the actual number of open files. It is just an error code. Looks like the log comes from Apache, but you only pasted one line without context, so there is not much to work with. – 400 the Cat Oct 9 '16 at 11:49
  • last question , I update the question with my limits.conf file , how to know if i can to increased the current values ? ( I mean I to know the max values that I can to increase ? ) – yael Oct 9 '16 at 11:55

There are two configurable limits of how many open files a system may handle. To see the hard and soft values, use:

ulimit -Hn
ulimit -Sn

IIRC most distros set the limit of file descriptors to 1024 per user. You can remove the limit using ulimit -n 0.

To permanently change this, adapt /etc/security/limits.conf and reboot system:

echo -ne " 
* soft nofile 65536 
* hard nofile 65536 
" >>/etc/security/limits.conf 
| improve this answer | |
  • about - Too many open files , can you describe please what was the root cause of this message ? , or example ? – yael Oct 9 '16 at 11:11
  • The root cause is somewhere in your system, but no one can know it except you. – Jan Oct 9 '16 at 11:30
  • so if I want to increase the value - how to know the MAX value ? of hard/soft – yael Oct 9 '16 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.