cancel
Showing results for 
Search instead for 
Did you mean: 
Tracy_Baker
Starfighter Starfighter
Starfighter
  • 1,930 Views

RHEL 8, RH134, Chapter 1, Sections 5 and 6 - errors and clarifications

In RHEL 8, RH134, Chapter 1, Section 5 there is an error:
1.JPG

The error is the N (capital) does not find the next match, n (lowercase) does. N finds the previous match. The lab (Chapter 1, Section 6) gets this correct.
a.JPG

-----------------

Speaking of the Chapter 1, Section 6 lab, there is this inconsistency:
2.JPG

It leads the reader to think that there is a postfix user and group as well as a postdrop user and group. This is not true; postdrop is not a user.

Therefore, the student will be searching for the UID and GID for postfix and just the GID for postdrop.

-----------------

Then there is this:
3.JPG

There are a couple of things here -- omissions:

  • In order to make a regex to search a file, we must know the format of the file. This is not mentioned anywhere in the content. You cannot blindly create a regex and expect it to work. I believe that this is an important point to make to students when they're introduced to regex; you need to know the format of the data being searched.  (This was also an issue in the RHEL 7, RH134, Chapter 2, Section 4 lab -- the one about Dr. Zingruber.)

 

  • The format of the /var/log/secure file, as it pertains to date and time, is Mmm dd hh:mm:ss -- this is important when trying to create a regex when the dd is a single digit. The lab's instructions were done on Mar 22, so this wasn't an issue. However, I re-wrote the lab today (Feb 6th). Because the format is dd, /var/log/secure has a 2 character field for the day. In this case, it writes it as:  2 (with a leading space instead of a leading 0). This leading space is significant when creating a regex. Leave it out and the grep will return nothing.

It's this, March 22nd and Feb. 6th written one on top of another:

Mar 22
Feb  6

The regexes would be (for example):

'^Mar 22 08:2.*GID'
'^Feb  6 08:2.*GID'

Program Lead at Arizona's first Red Hat Academy, est. 2005
Estrella Mountain Community College
2 Replies
mital
Cadet
Cadet
  • 1,366 Views

i'm doing the samething but i still nothing to get...command

grep '^Jun 3 22:5.*GID' /var/log/secure

0 Kudos
Tracy_Baker
Starfighter Starfighter
Starfighter
  • 1,354 Views

@mital 

It looks like you forgot the space - which was the point of my post. You wrote:

grep '^Jun 3 22:5.*GID' /var/log/secure

What should work is:

grep '^Jun  3 22:5.*GID' /var/log/secure

Notice that there are TWO spaces between Jun and 3 because the date field requires two characters for grep to work.

Of course, it is possible that your regular expression (regex) doesn’t match anything in /var/log/secure. For your regex to work, these things must exist in the file:

  1. a line that begins with this (don't forget the two spaces): Jun  3 22:5
  2. AND this exists somewhere later in the same line: GID

Here's a screen shot of a similar search, with the results. First without two spaces between Jun and 4 (since today is June 4th at about 2:15am) which produces no output and then with two spaces which does produce output:

1.JPG

 

Program Lead at Arizona's first Red Hat Academy, est. 2005
Estrella Mountain Community College
0 Kudos
Join the discussion
You must log in to join this conversation.