LOG files Lots of logs are created. "grep" them to extract information. Here are some examples: ( 'grep -v' EXCLUDES the greped word or phrase) ( use ' egrep "word1|word2|word3" ' for multiple words; "egrep -i " is case insensitive ********************************************************** Which hw_host is going offline? egrep "online|offline" /data/log/watchdog.log Is the detector offline (look at last entry of): egrep "online|offline" /data/log/watchdog.log | grep detector Was there a retry error? grep retry /data/log/det_api_workstation.log ***************************************************************** When was door opened/closed? egrep "completed|request" /data/log/pmac1DHS.log | grep -v normal | awk '{print $2,$3,$4,$(NF-2),$(NF-1),$NF}' Look for all moves of the collimator or detector grep "completed" /data/log/pmac1DHS.log Look for all moves of the collimator or detector NOT normally completed grep "completed" /data/log/pmac1DHS.log | grep -v normal Look for all moves of the collimator or detector NOT normally completed, nicely formated: grep "completed" /data/log/pmac1DHS.log | grep -v normal | awk '{print $2,$3,$4,$(NF-2),$(NF-1),$NF}' When was hutch parked, i.e. in an "enterable" state grep hutch_parker /data/log/watchdog.log | grep 1.0000 When and what were the last 10 images collected? grep image_ready /data/log/touch.log | tail -10 ********************************************************** change.log The only log which is not archived then and restarted when the system restarts (nukes). Therefore you can access this log for motor positions and other values at time in the past. All other logs have their names changed by appending a number to log, e.g. touch.log.569, then they are recreated and new logging starts after each 'nuke'. Get a list of last good Theta2 values tac /data/log/change.log | grep Theta2 | less When did the user change, or typed 'finished' tac /data/log/change.log | grep user | less tac /data/log/change.log | grep user | awk '{print $1,$2,$3,$22}' | less When was system restarted? tac /data/log/change.log | grep restart | less Look for recent info about M1 mirror tail -111111 /data/log/change.log | grep M1 | less Check which pinhole was last used for a "realign.com" by: grep pinhole /data/log/change.log ******************************************************************************** Get a complete summary of all data sets collected by users since last nuke: dataset_history.com /data/log/watchdog.log ********************************************************** When were images were ready? --this will list ALL of them: grep image_ready /data/log/watchdog.log Faster better way for listing recently collected images: tac /data/log/watchdog.log | grep image_ready | less ***************************************************** How many images have user's taken during this "nuke" user_history.com /data/log/watchdog.log ********************************************************** Find last good Theta2 Values, e.g. tac /data/log/change.log | grep Theta2 | less ********************************************************** When was beam given (or taken away from) to users? grep deliver /data/log/watchdog.log | tail -20 ********************************************************** When was the door or try ajar? grep door_or_tray_ajar /data/log/watchdog.log ********************************************************** When did user do something wrong? grep WARNING /data/log/watchdog.log ********************************************************** When did user attempt to move the collimator while the door or tray was ajar? grep ajar /data/log/watchdog.log (or touch.log) ******************************************************` Where was Touch Screen Touched? grep touch /data/log/touch.log | grep area\ ******************************************************** What were the last 100 images taken? grep image_ready /data/log/touch.log | tail -100 **************************************************************** List ALL the images created since last nuke: grep image_ready /data/log/touch.log >! junk.file Summarized the contents of "junk.file" in 100 lines or less: summarize.com 100 junk.file Summarized the contents of "junk.file" in 40 lines or less: summarize.com 40 junk.file (summarize.com was originally written for making a succinct label for DVD's) **************************************************************** To create a "bug report" for a maulfunctioning script do this: /bin/csh -vf /programs/beamline/shutter.com close >&! bugreport.txt This will put a "verbose" version of the script run into the file "bugreport.txt". *********************************************************************** Here's an example of using awk for some detective work: Looks like the beam stop got whacked somewhere between 4:02am and 4:05am. In fact, it was probably between 04:02:32 and 04:02:56 awk '/image_ready/ && /sun/{print $2,$3,$4,$NF} /door/{print $2,$3,$4,$(NF-1),$NF}' /data/log/watchdog.log Jan 23 04:01:37 /data/mcfuser/ucsf/stroud/sun/pseudoU_01_23_04/pseudoU_2_5_1_179.img Jan 23 04:02:13 /data/mcfuser/ucsf/stroud/sun/pseudoU_01_23_04/pseudoU_2_5_1_180.img Jan 23 04:02:32 door open Jan 23 04:02:56 door closed Jan 23 04:05:21 /data/mcfuser/ucsf/stroud/sun/pseudoU_01_23_04/test_4_1_0_001.img Jan 23 04:05:54 door open Jan 23 04:06:15 door closed Jan 23 04:08:09 /data/mcfuser/ucsf/stroud/sun/pseudoU_01_23_04/test_5_5_0_002.img Jan 23 04:09:08 door open Jan 23 04:09:12 door closed Jan 23 04:10:00 /data/mcfuser/ucsf/stroud/sun/pseudoU_01_23_04/test_5_5_0_003.img Jan 23 04:11:18 door open Jan 23 04:11:36 door closed Jan 23 04:22:35 door closed Looks like the beam stop got whacked somewhere between 4:02am and 4:05am. In fact, it was probably between 04:02:32 and 04:02:56 awk '/image_ready/ && /sun/{print $2,$3,$4,$NF} /door/{print $2,$3,$4,$(NF-1),$NF}' /data/log/watchdog.log Jan 23 04:01:37 /data/mcfuser/ucsf/stroud/sun/pseudoU_01_23_04/pseudoU_2_5_1_177.img Jan 23 04:01:49 /data/mcfuser/ucsf/stroud/sun/pseudoU_01_23_04/pseudoU_2_5_1_178.img Jan 23 04:02:01 /data/mcfuser/ucsf/stroud/sun/pseudoU_01_23_04/pseudoU_2_5_1_179.img Jan 23 04:02:13 /data/mcfuser/ucsf/stroud/sun/pseudoU_01_23_04/pseudoU_2_5_1_180.img Jan 23 04:02:32 door open Jan 23 04:02:56 door closed Jan 23 04:05:21 /data/mcfuser/ucsf/stroud/sun/pseudoU_01_23_04/test_4_1_0_001.img Jan 23 04:05:54 door open Jan 23 04:06:15 door closed Jan 23 04:08:09 /data/mcfuser/ucsf/stroud/sun/pseudoU_01_23_04/test_5_5_0_002.img Jan 23 04:09:08 door open Jan 23 04:09:12 door closed Jan 23 04:10:00 /data/mcfuser/ucsf/stroud/sun/pseudoU_01_23_04/test_5_5_0_003.img Jan 23 04:11:18 door open Jan 23 04:11:36 door closed Jan 23 04:22:35 door closed Jan 23 08:00:09 door open ********************************************************************************* ********************************************************** ------------- BL821 & 822 -------------- A way to find the last good M2 and Chi values (where current was greater than 1000): on BL822 (computer and file names have changed, now): F-secure (or something) to bcsb-gateway.lbl.gov (or is it "bcsb-gw.als.lbl.gov") gateway% ssh dcsuser@bl82c Password: ****** bl82c% setenv beamline 822 bl82c% feedback.com off bl82c% grep "bl$beamline" change.log | grep M2 | awk '$NF>1000 {print $(NF-2)}' | tail -1 10850 bl82c% grep "bl$beamline" change.log | grep Chi2 | awk '$NF>1000 {print $(NF-2)}' | tail -1 1.07824 bl82c% blmotor.com M2 Tilt 10850 bl82c% blmotor.com Chi2 1.07824 bl82c% tuneup.com bl82c% feedback.com keep _---------------------From Corie July 2005: By the way, the Tuneup log is in the dcsuser home account: /remote/data/prod/users/dcsuser/Beamline.log **********************************************************************