Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Contributions to ELOG, Page 2 of 6  Not logged in ELOG logo
ID Date Authordown Author Email Category Subject Status Last Revision
  33   Thu Feb 3 23:51:16 2011 T. Ribbrockemgaron+elog@ribbrock.orgOtherBuilding elog on OpenBSDStable 

Two things are required to get elog (tested with 2.8.1) to compile on OpenBSD (tested on OpenBSD 4.8):

Step 1 - Patch Makefile:

--- Makefile~ Mon Jan 24 21:38:09 2011
+++ Makefile Mon Jan 24 21:42:57 2011
@@ -50,6 +50,10 @@
 RM = /usr/bin/rm -f
 endif

+ifeq ($(OSTYPE),OpenBSD)
+LIBS += -lcrypto
+endif
+
 ifeq ($(OSTYPE),Darwin)
 OSTYPE=darwin
 endif

Step 2 - Use "gmake" instead of the standard "make" to build.

 

  37   Tue Aug 23 19:45:16 2011 Stuart Wilkinsswilkins@bnl.govScriptELOG Mail ParserAlpha 

 Hi!

I have attached a small script which can process an e-mail and submit this e-mail as a log entry. This is alpha at the moment but if you have suggestions or find bugs please let me know. 

The easiest way to process this is to use the ".forward" file in unix. If this file contains the line:

| "/usr/bin/python /home/tardis/elogmail/process.py --log /home/tardis/elogmail/mail.log -r -u http://localhost:8080/TARDIS -a Category=email -a Type=Log"

This will pipe the incoming mail to the e-log running on the localhost with the experiment TARDIS. Attributes can be set using the "-a" switch like in the elog command line utility. To get help with all the options please run the script with the command:

python process.py -h

which will give help.

Any questions, please don't hesitate to contact me, and I will do my best to help.

Thanks again to Stefan for a great application.

Best wishes,

Stuart

 

Attachment 1: process.py.gz
Attachment 2: forward.gz
  9   Wed Jul 7 18:19:10 2004 Steve Jonessteve.jones@freescale.comScriptGeneric Unix elogd init scriptStableWed Jul 7 18:19:38 2004 by Steve Jones
The elogd.init script that ships in the elog distribution is Linux centric.
 This script is written to work in a generic Unix environment under 'sh' -
no frills!
Attachment 1: elogd.init
#!/bin/sh

# description: Start elog
# elog can have multiple instances run on the same server, pointing to different logbook areas.  This start
# script should be run from the root of each different elog area.

ELOGD="/_TOOLS_/dist/gnu-elog-2.5.3/sparc-sun-solaris2.8/bin/elogd"
ELOGDIR="/proj/sysadmin/ess/www/elog"
HOSTNAME=`hostname`

# Check for the config file
if [ ! -f $ELOGDIR/elogd.cfg ]; then
    exit 0
fi


# See how we were called.
case "$1" in
  start)
        if [ -f $ELOGDIR/elogd-$HOSTNAME.pid ] ; then
	   pid=`cat ./elogd-$HOSTNAME.pid`
	   if [ -d /proc/$pid ] ; then
	     echo "elogd already running"
	     exit 1
	   fi
	fi
####################################
# The full path *must* be specified
	echo "Starting elogd: "
	$ELOGD -f $ELOGDIR/elogd-$HOSTNAME.pid -c $ELOGDIR/elogd.cfg -D  > /dev/null 2>&1 &
	RETVAL=$?
        if [ $RETVAL -eq 0  ] ; then 
          echo "elog started" 
        else
          echo "Failed to start elog"
        fi
	echo
	;;
  stop)
     echo ""
      if [ -f $ELOGDIR/elogd-$HOSTNAME.pid ] ; then
        echo "Stopping elogd: "
        kill `cat $ELOGDIR/elogd-$HOSTNAME.pid`
	rm -f $ELOGDIR/elogd-$HOSTNAME.pid
        echo "elog stopped"
        echo
     else
        echo "No elogd running?"
	echo "Failed to start elog"
	echo
     fi
     
	;;
  restart|reload)
	$0 stop
	$0 start
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit 0

  23   Fri Jul 13 12:36:45 2007 Stefan Rittstefan.ritt@psi.chOtherRe: Compiling elogd.c on HP-UX 64 bitBetaThu Jul 12 09:38:47 2007 by Peter Rienstra
I applied most of your patches to the elog source code, SVN revision 1885. The only missing piece has to do with seteuid/setuid. I definitively need seteuid for linux, because elogd might be started under root, then it falls back to an optional elog user. But when it stops, it has to restore the original root user in order to delete the PID file (/var/run/elogd.pid) which was created under root. If seteuid does not exist under HP-UX, you should add something like
#ifdef HP-UX
  setuid(...)
#else
  seteuid(...)
#endif

Probably the HP-UX has to be something else, but I cannot test this since I don't have such an OS here. Once you get this working I can put it into the standard distribution.
  25   Mon Jul 16 15:57:47 2007 Stefan Rittstefan.ritt@psi.chOtherRe: Compiling elogd.c on HP-UX 64 bitBetaThu Jul 12 09:38:47 2007 by Peter Rienstra

Peter Rienstra wrote:
HP-UX doesn't have the "seteuid" and "setegid" functions. But there are "setuid+setgid", "setreuid+setregid" and "setresuid+setresgid" functions available.


I had a look and found that setreuid/setregid is also available under Linux, so I use those functions instead, which should also work on HP-UX. Can you check revision 1888 (http://savannah.psi.ch/viewcvs/trunk/src/elogd.c?root=elog&rev=1888), compile it and see if you can run it at least under your non-root account.
  30   Mon Jul 20 14:23:56 2009 Stefan Rittstefan.ritt@psi.chScriptDoing mathematical calculations with attributesStable 

Following entry was written by Richard Stamper. I moved it here for persistency:

On the matter of automatic calculation of fields, it is possible using included javascript but you have to do the work yourself.  For example, we have a log which computes responsivity as the ratio of a photocurrent and optical power.  With log attributes called "Photocurrent", "Optical Power" and "Responsivity" there is a file in the logbooks directory called photomixer_javascript.html containing something like:

<script>

if (document.form1.Photocurrent) {
  document.form1.Photocurrent.onchange = new Function(
    "mod();"+
    "var power = parseFloat(
document.form1.Optical_Power.value);"+
    "var current = parseFloat(
document.form1.Photocurrent.value);"+
    "if (!isNan(power) && !isNan(current) && power != 0.0) {"+
    "  
document.form1.Responsivity.value = Math.round(current/power*100)/100.0"+
    "}"
    );

  document.form1.Optical_Power.onchange = document.form1.Photocurrent.onchange;
}

</script>

and the elogd.cfg file includes

Bottom text = photomixer_javascript.html

for the relevant log.

The assignments to the onchange handlers are guarded because this javascript is included on all pages for that log, including the list pages where there is no such field as Photocurrent, (or Optical_Power) and the event handler function is defined dynamically for the same reason.

 

  39   Fri Sep 17 06:19:39 2010 Stefan Rittstefan.ritt@psi.chScriptCustom input forms implementationStableThu Jul 2 20:55:55 2015 by Stefan Ritt

Dear ELOG users,

starting with SVN revision 2328, custom input forms are implemented. This allows application specific formats for check lists etc. In our specific case we had to implement a shift check list, which was quite long. Furthermore the check list should be optimized for an iPad, which we take in the field and record various checks and readings (in our case some gas pressure gauges at the PSI particle accelerator). Since the standard ELOG interface was too inflexible, a completely hand-written form was needed. The form can be activated by the new configuration options Custom New Form, Custom Edit Form and Custom Display Form, one for a new entry, an entry to edit and and entry to display. In our case we used the same form for all three cases. This is how the shift check list looks under the Safari Browser on a PC:

Capture.png

And here is how it looks on the iPad:

IMAG0036.jpg

Each section can be collapsed and expanded (blue arrows at the left), and various internal checks are made before the check list can be submitted.

Implementing such forms is however more something for the advanced user, since you have to hand-write HTML with CSS and JavaScript code. It can then however be a powerful method for check lists. Please find in the attachments the elogd.cfg configuration for that logbook and the shiftcheck.html source code file. It is a bit complicated since the page is a static page, elogd just serves it from the file. This requires all the dynamic functions to be implemented inside the HTML file with JavaScript. To display an entry for example, the JavaScript loads the raw data with the "?cmd=Download" command and the populates the form fields. The collapsing and expanding is done by using CSS properties. The integrated style sheet was optimized for the rendering on an iPad. Rather large fonts were chosen so that the items can be checked easily with your finger tips. Various parameters are sent between the browser and the elogd program via hidden fields and cookies. So only something for experts! But if you go through the effort and hand-write the form, it can be very handy. Note that you have to upgrade to SVN revision 2328 for the three new options.

 

Attachment 2: elogd.cfg
[global]
Port = 8080
Password file = passwd

[ShiftCheck]
Comment = Shift Check List

Attributes = Author, D, M, Y, Shift, a1, a2, a3, a4, a5, h1, h2, h3, h4, h5, c1, c2, c3, c4, c5, c6, c7, bb1, cr1, cr2, cr3, cr4, cr5, cr6, cr7, cr8, cr9, cr10, cr11, cr12, cr13, cr14, cr15, cr16, cr17, cr18, cr19, cr20, cr21, cr22, cr23, cr24, cr25, cr26, sw1, sw2, sw3, sw4, sw5
Quick filter = Shift, Author
Options Shift = Morning, Evening, Night

Enable attachments = 0
Show text = 0
Custom new form = /home/meg/meg/online/elog/shiftcheck.html
Custom edit form = /home/meg/meg/online/elog/shiftcheck.html
Custom display form = /home/meg/meg/online/elog/shiftcheck.html
List after submit = 1
Attachment 4: shiftcheck.html
Attachment 5: sc_up.png
sc_up.png
Attachment 6: sc_down.png
sc_down.png
  34   Fri Feb 4 10:26:38 2011 Stefan Rittstefan.ritt@psi.chOtherRe: Building elog on OpenBSDStable 

T. Ribbrock wrote:

Two things are required to get elog (tested with 2.8.1) to compile on OpenBSD (tested on OpenBSD 4.8):

Step 1 - Patch Makefile:

--- Makefile~ Mon Jan 24 21:38:09 2011
+++ Makefile Mon Jan 24 21:42:57 2011
@@ -50,6 +50,10 @@
 RM = /usr/bin/rm -f
 endif

+ifeq ($(OSTYPE),OpenBSD)
+LIBS += -lcrypto
+endif
+
 ifeq ($(OSTYPE),Darwin)
 OSTYPE=darwin
 endif

Step 2 - Use "gmake" instead of the standard "make" to build.

 

Thanks, I added your patch to the distribution. 

  36   Tue Aug 23 12:07:51 2011 Stefan Rittstefan.ritt@psi.chScriptRe: JavaScript list auto-refreshStableTue Jul 12 12:36:16 2005 by Emiliano Gabrielli

Emiliano Gabrielli wrote:
Here is a simple piece of JS code to accomplish a smart page reload.
We don't reload if in some kind of editing mode.

You can put the code everywhere you like in the elog html page, my suggestion is to put it in Bottom Text (or Top Text):

;auto-refresh
Bottom text = [I]<script language="JavaScript">if (null==window.location.href.match('/[0-9]+$|.*(cmd|select)=.*') ) { window.setTimeout("location.reload();", 2*60*1000); now=new Date(); document.write('<br/>Last reload at '+now.getFullYear()+'/'+(now.getMonth()+1)+'/'+now.getDate()+', '+( ((h=now.getHours())<10) ? '0'+h :h)+':'+( ((m=now.getMinutes())<10) ? '0'+m :m)+':'+( ((s=now.getSeconds())<10) ? '0'+s :s)) }</script>[/I]


the timer is a product of # of minutes, #of seconds and milliseconds... 2 minutes in the above example Smile



Revision Tue Jul 12 12:36:16 2005 wrote:

modified regular expression in order to not activate the auto-refresh in the signle entry view


Starting with SVN revision 2422, there is a new config option

refresh = <seconds>


which lets you do the same thing.
  41   Mon Jan 7 16:37:21 2013 Stefan Rittstefan.ritt@psi.chScriptRe: Server time offsetStable 

Bruce Weber wrote:

Our server runs on local time, however, we require log entries to be in UTC (-0800hrs) - is there a command to achieve this?

Your assistance will be much appreciated

Thanks

Have you tried

 

Subst <attribute> = $utcdate

 

Probably you need a dedicated attribute of type "datetime" and have to play with the "Date format" options.

ELOG V3.1.5-2eba886