Log rotate Configuration File.

# cat /etc/logrotate.conf
# see “man logrotate” for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
dateext

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp — we’ll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
minsize 1M
rotate 1
}

/var/log/btmp {
missingok
monthly
create 0600 root utmp
rotate 1
}

# system-specific logs may be also be configured here.

 

Daily CRON Job logrotate added

# cat /etc/cron.daily/logrotate
#!/bin/sh
/usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate “ALERT exited abnormally with [$EXITVALUE]”
fi
exit 0

 

Know the status cat /var/lib/logrotate/logrotate.status

Command to rotate logs manually try below commands

logrotate -f /etc/logrotate.conf
logrotate -vf /etc/logrotate.conf
logrotate -d /etc/logrotate.conf


Note

          below testing Server load commands and script only for testing not recommended for Live production server & dont executed in Physical server Hardware may fail try in VMware and Cloud servers.

 

Download rpm – https://rpmfind.net/linux/rpm2html/search.php?query=stress

Install stress rpm – rpm -ivh stress-xxx-.rpm

 

Stress.sh

#!/bin/bash
m=M
MEM=$(free -m | grep ‘Mem:’ | awk ‘{print $7}’)
fmem=$(echo “$MEM*0.95” | bc)
fmem=$( printf “%.0f” $fmem )
CPU=$(grep -c ^processor /proc/cpuinfo)
FCPU=$((CPU-1))
stress –cpu $FCPU -m 1 –vm-bytes $fmem$m –timeout 300

 

Monitor Load using below script

#cat Monitor_load.sh
#!/bin/bash
MEMORY=$(free -m | awk ‘NR==2{printf “%.2f%%\t\t\n”, $3*100/$2 }’)
CPU=$(top -d 0.5 -b -n2 | grep “Cpu(s)”|tail -n 1 | awk ‘{print $2 + $4+ $6}’)
echo “Memory Usage = ${MEMORY}”
echo “CPU Usage = ${CPU}”

 

useful commands during High Server Load testing

top

uptime
free -m
sar -r
sar 5 5


Possibilities of Gateway is not pining issue

  1. Check Physical connection BW server and switch
  2. Check VLAN id is correct BW server and switch
  3. Check default Firewall rules are disabled or not
  4. Check HW Address && UUID of eth0 interface is correct?
  5. Use correct netmask parameter & netmask IP address should be same.

PREFIX=20
NETMASK=255.255.240.0


# RHEL 5
# ------------------------------------------------------------------------------------------

# To force users to enter password in Single User mode, add following line to /etc/inittab:

~:S:respawn:/sbin/sulogin

# The changes to this file takes effect after a system reboot

# To make init re-read the /etc/inittab without rebooting the system, type the command

/sbin/init q



# RHEL 6
# ------------------------------------------------------------------------------------------

# Edit /etc/inittab and add "su:S:wait:/sbin/sulogin" before 'initdefault' line:

vi /etc/inittab
   [...]
   su:S:wait:/sbin/sulogin
   id:3:initdefault:

# Edit /etc/sysconfig/init and replace "SINGLE=/sbin/sushell"  with "SINGLE=/sbin/sulogin":

vi /etc/sysconfig/init
   [...]
   # Set to '/sbin/sulogin' to prompt for password on single-user mode
   # Set to '/sbin/sushell' otherwise
   SINGLE=/sbin/sulogin



# RHEL 7
# ------------------------------------------------------------------------------------------

# By default, Single User mode is password protected by the root password on RHEL 7:

cat /usr/lib/systemd/system/rescue.service
   [...]

   [Service]
   Environment=HOME=/root
   WorkingDirectory=/root
   ExecStartPre=-/bin/plymouth quit
   ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type [...]
   ExecStart=-/bin/sh -c "/usr/sbin/sulogin; /usr/bin/systemctl --fail --no-block default" <---
   Type=idle
   StandardInput=tty-force
   StandardOutput=inherit
   StandardError=inherit
   KillMode=process
   IgnoreSIGPIPE=no
   SendSIGHUP=yes

#ifconfig -a

#ip link set dev ens224 name eth1

#ifconfig -a

openstack key commands

Posted: March 26, 2018 in key commands, openstack

[root@rhel7- ~]# openstack stack list – —->stack complete container of Open stack

[root@rhel7 ~]# openstack image list —-> Like a ova that deployed as image in OS

[root@rhel7 ~]# openstack server list or nova list — > created Servers

[root@rhel7 ~]#openstack flavor list —>it like template what configuration use for server

[root@rhel7- ~]# openstack volume list or # cinder list — > list of Volume

[root@rhel7-~]# neutron net-list —-> Network List like a VLAN networking

[root@rhel7-i ~]# neutron subnet-list

[root@rhel7- ~]# neutron router-list

[root@rhel7-i~]# openstack flavor list


#cinder list

#mysql

MariaDB [(none)]> use cinder ;

MariaDB [cinder]> update volumes set attach_status=’detached’,status=’available’ where id ='<Volume id> ;

MariaDB [cinder]>exit

#cinder delete <volume_id>