BookmarkSubscribeRSS Feed
Robert
Fluorite | Level 6

We have some web logs that we need to analyze for site traffic. I know I could write some DATA step code to parse through these logs and pick out relevant data, but I'm sure there must be some code or macros that can do this already. An example of the raw log data is below:

127.0.0.1 - - [13/Dec/2017:12:40:19 +0000] "GET /index.action HTTP/1.1" 401 58
127.0.0.1 - - [13/Dec/2017:12:40:24 +0000] "GET /login.action HTTP/1.1" 401 58
127.0.0.1 - - [13/Dec/2017:12:40:30 +0000] "GET /struts2-showcase/person/editPerson.action HTTP/1.1" 404 1033
127.0.0.1 - - [13/Dec/2017:12:40:36 +0000] "GET /struts2-showcase/showcase.action HTTP/1.1" 404 1015
127.0.0.1 - - [13/Dec/2017:12:40:41 +0000] "GET /struts-cookbook/processSimple.do HTTP/1.1" 404 1015
127.0.0.1 - - [13/Dec/2017:12:40:47 +0000] "GET /portal/client/cms/viewcmspage.action HTTP/1.1" 404 1023
127.0.0.1 - - [13/Dec/2017:12:40:53 +0000] "GET /admin/agent/default.action HTTP/1.1" 404 1003
127.0.0.1 - - [13/Dec/2017:12:40:58 +0000] "GET /index.do HTTP/1.1" 401 58
127.0.0.1 - - [13/Dec/2017:12:41:04 +0000] "GET /Dashboard.action HTTP/1.1" 401 58

1 REPLY 1
Patrick
Opal | Level 21

If it's SAS Logs then the SAS Environment Manager provides quite a bit for such tasks.

 

For other logs: I agree with you that this is a problem which people must have solved already but whenever I actually need something specific I end up not finding anything pre-fabricated where amending the code for my specific use case wouldn't take me as long as writing new (and much simpler) code from scratch.

 

Looking at the log layout you've posted: That's so nicely structured that it shouldn't be too hard to parse out what you need.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 664 views
  • 0 likes
  • 2 in conversation