Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a log file that logs information when the values set in /etc/security/limits.conf are exceeded?

If the values are too tight in the above file the clients using the website hosted on the server sees errors such as [FATAL] failed to allocate memory . But I wont be intimidated about it. So is there a log?

If not is there a way to make it log when the values are exceeded?

share|improve this question

3 Answers 3

up vote 3 down vote accepted
+100

limits.conf is a too blunt an instrument for what you are trying to do.

cgroups will set limits and provide accounting for you, but the documentation is a little obtuse! https://www.kernel.org/doc/Documentation/cgroups/memory.txt

share|improve this answer

Is there a log file that logs information when the values set in /etc/security/limits.conf are exceeded?

Nope.

All those values go at last to process resource limits (man setrlimit) and when they met there's no universal mechanism to issue an warning to be logged.

share|improve this answer

if your issue is about memory allocation failed you could also use this script to monitor percentage of free memory left

#!/bin/bash
# you can adjust 0.20 meaning 20% to percentage of memory free you want 
output=$(free | grep "Swap" | awk '{if (($4/$2) < 0.20) print "memory low"}')
if [[ "$output" != "" ]]; then
    echo "..." | mail -s "Memory low on <host>" <monitoring email>
fi

save it to script file (ex. memmon.sh) and add to crontab it will send email and write log file when detect free memory low as conditioned)

# Ex. monitor every 3 min.
*/3 * * * * /home/user/memmon.sh >> /home/user/memmon.log
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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