HOWTO extract Nginx logs for the past hour/s

Here’s a quick and handy “awk” snippet to extract data from Nginx’s access or error log file for the past hour/s.

# awk -v d1="$(date --date '-60 min' '+%d/%b/%Y:%T')" '{gsub(/^[\[\t]+/, "", $4);}; $4 > d1' /var/log/nginx/access.log

This example shows how to extract data from /var/log/nginx/access.log for the past 60 minutes – ‘-60 min’.

HOWTO exclude specific packages from being updated via yum or dnf

Here are a few examples on how to exclude some packages from being updated during yum/dnf update:

# yum update --exclude=PACKAGENAME 

Exclude all kernel related packages during update:

# yum update --exclude=kernel*

Exclude gcc and java:

# yum update --exclude=gcc,java

Exclude all gcc and php related packages:

# yum update --exclude=gcc* --exclude=php*

In order to permanently exclude/disable updating of some specific packages you might want to update your dnf.conf or yum.conf eg:

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exclude=kernel* php*             <---