Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

(Solved) Logs not working after modify syslog file.

Featured Replies

Hi,

I've got a problem with logs, so I wrote a script to modify syslog files but after script is done logs not working, they are freezed and nothing is written to them. This happend when I modify "syslog" file. However I notice that when I was using this script for only "syslog.2" and "syslog.1" without "syslog", everything was fine; the logs were working and the lines with error was deleted. So maybe someone can help me find out how to make logs work after script is done or maybe someone know where is the problem.

Maybe someone know how log works in unraid, how they are created, how they are splitted, what is the max size of syslog etc. and could explain it to me.

I've checked permission after modification and change it to exactly how they was before modify but it not work and logs were still freezed.

This is my script. I know it's kinda stupid but it might work for me.

#!/bin/bash
cd /var/log/
grep -v "input irq status" syslog.5 syslog.4 syslog.3 syslog.2 syslog.1 syslog >> tempfile 
diff <(tail -n 15 syslog) <(tail -n 15 tempfile) 1>/dev/null
if [[ $? == "0" ]]
then
  echo "The same"
  rm syslog.*
else
  echo "Not the same"
fi
diff <(tail -n 15 syslog) <(tail -n 15 tempfile)
if [[ $? == "0" ]]
then
  echo "The same"
  mv tempfile syslog
  rm tempfile
else
  echo "Not the same"
fi
echo "Done"

 

  • Community Expert

The syslog process has the current syslog file open all the time, and anything you try to do to that file while syslog process has it open is probably breaking the syslog process.

 

The "rotated" syslog.1, etc. are safe to work on since they aren't open any more.

  • Author

I've added two command to my script and it is working, so thanks for help.

#!/bin/bash
cd /var/log/
echo "Stoping log service..."
/etc/rc.d/rc.rsyslogd stop
grep -h -v "input irq status" syslog.5 syslog.4 syslog.3 syslog.2 syslog.1 syslog >> tempfile 
diff <(tail -n 15 syslog) <(tail -n 15 tempfile) 1>/dev/null
if [[ $? == "0" ]]
then
  echo "The same"
  rm syslog.*
else
  echo "Not the same"
fi
diff <(tail -n 15 syslog) <(tail -n 15 tempfile)
if [[ $? == "0" ]]
then
  echo "The same"
  mv tempfile syslog
else
  echo "Not the same"
fi
/etc/rc.d/rc.rsyslogd start
echo "Done"

 

Edited by Mr.xs

  • Mr.xs changed the title to (Solved) Logs not working after modify syslog file.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.