- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- print a particular line
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2004 04:08 PM
тАО10-07-2004 04:08 PM
I have a log file to log ftp connection. A successful ftp connection will be something like this:
connection from ::ffff:123.2.3.4
FTP LOGIN from 123.2.3.4, user1
You will not see the sentence FTP LOGIN if the ftp login is incorrect.
How do I check from the log file to check those incorrect ftp login?
Solved! Go to Solution.
- Tags:
- ftp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2004 05:48 PM
тАО10-07-2004 05:48 PM
Re: print a particular line
does this helps?
# cat logfile | grep -v "FTP LOGIN"
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2004 06:56 PM
тАО10-07-2004 06:56 PM
Re: print a particular line
you can also do a:
grep -i "ftp login" /path/filename
if you want to check the last occurrance you may as well pipe it to "tail -1"
hope this helps too!
regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2004 07:00 PM
тАО10-07-2004 07:00 PM
Re: print a particular line
will still show other tranactions such as file transfer, logging out.
If there is a way to check for "connection from" and if the next line is not "FTP LOGIN from", then the chance of unsuccessful login is high.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2004 07:19 PM
тАО10-07-2004 07:19 PM
Re: print a particular line
# cat testfile
connection from ::ffff:123.2.3.4
FTP LOGIN from 123.2.3.4, user1
connection from ::ffff:123.2.3.4
FTP from 123.2.3.4, user1
connection from ::ffff:123.2.3.4
FTP LOGIN from 123.2.3.4, user1
connection from ::ffff:123.2.3.4
FTP from 123.2.3.4, user1
# awk '/connection/ { IP=$3; getline; if ( $1 == "FTP" && $2 == "LOGIN" ) print IP " FTP connection OK" }' testfile
::ffff:123.2.3.4 FTP connection OK
::ffff:123.2.3.4 FTP connection OK
It will give you successful IP-Address there by checking connection keyword and FTP LOGIN there.
HTH.
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2004 07:24 PM
тАО10-07-2004 07:24 PM
Re: print a particular line
# cat logfile | grep -E 'FTP FAILED | connection from'
This should work.
I don't know exaclty what is the message of failed FTP login but you can use the same in grep command with E option as shown above.
Hope that helps.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2004 07:26 PM
тАО10-07-2004 07:26 PM
Re: print a particular line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2004 07:48 PM
тАО10-07-2004 07:48 PM
Re: print a particular line
What I observe in the log, an unsuccessful login will not show message such as "FTP FAILED", "Error login FTP",etc. It will just show there is connection from an ip.
E.g. 3 unsuccessful login from 123.2.3.4/7/9 will be shown as :
connection from ::ffff:123.2.3.4
connection from ::ffff:123.2.3.7
connection from ::ffff:123.2.3.9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2004 08:01 PM
тАО10-07-2004 08:01 PM
Solutionif pattern connection from found and it's next lines pattern is not that FTP LOGIN from then, we have to prompt error.
Take from my prev. reply example,
So try as,
# awk '/^connection from/ { line=$0 } { getline; if ( $1 != "FTP" || $2 != "LOGIN" || $3 != "from" ) print line" "$0" Failed" }' testfile
connection from ::ffff:123.2.3.4 FTP from 123.2.3.4, user1 Failed
connection from ::ffff:123.2.3.4 FTP from 123.2.3.4, user1 Failed
To do more accurate then,
# awk '/^connection from/ { line=$0 } { getline; if ( $1 == "FTP" && $2 == "LOGIN" && $3 == "from" ) print line" "$0" SUCCESS"; else print line" "$0" FAILED" }' testfile
connection from ::ffff:123.2.3.4 FTP LOGIN from 123.2.3.4, user1 SUCCESS
connection from ::ffff:123.2.3.4 FTP from 123.2.3.4, user1 FAILED
connection from ::ffff:123.2.3.4 FTP LOGIN from 123.2.3.4, user1 SUCCESS
connection from ::ffff:123.2.3.4 FTP from 123.2.3.4, user1 FAILED
It will give SUCCESS / FAILED informations there.
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2004 08:14 PM
тАО10-07-2004 08:14 PM
Re: print a particular line
I do some modification to Muthukumar's solution and derived :
# cat testfile
connection from ::ffff:123.2.3.4
FTP LOGIN from 123.2.3.4, user1
connection from ::ffff:123.2.3.4
FTP from 123.2.3.4, user1
connection from ::ffff:123.2.3.4
FTP LOGIN from 123.2.3.4, user1
connection from ::ffff:123.2.3.4
FTP from 123.2.3.4, user1
connection from ::ffff:123.2.3.12
connection from ::ffff:123.2.3.44
connection from ::ffff:123.2.3.12
connection from ::ffff:123.2.3.4
FTP from 123.2.3.4, user1
#awk '/connection/ { IP=$3; getline; if ( $0 !~ /.FTP.*/) print IP " FTP connection incorrect" }' testfile
::ffff:123.2.3.12 FTP connection incorrect
::ffff:123.2.3.44 FTP connection incorrect
::ffff:123.2.3.12 FTP connection incorrect