Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Discussion forum about ELOG  Not logged in ELOG logo
icon4.gif   Using the command line tool to edit, posted by T. Ribbrock on Thu Aug 7 10:12:25 2008 
    icon2.gif   Re: Using the command line tool to edit, posted by Yoshio Imai on Fri Aug 8 14:27:03 2008 
       icon2.gif   Re: Using the command line tool to edit, posted by T. Ribbrock on Fri Aug 8 14:50:56 2008 
    icon2.gif   Re: Using the command line tool to edit, posted by Stefan Ritt on Mon Aug 11 11:02:18 2008 
       icon2.gif   Re: Using the command line tool to edit, posted by T. Ribbrock on Mon Aug 11 15:14:40 2008 
Message ID: 65950     Entry time: Mon Aug 11 15:14:40 2008     In reply to: 65949
Icon: Reply  Author: T. Ribbrock  Author Email: emgaron+elog@ribbrock.org 
Category: Question  OS: Linux  ELOG Version: 2.7.4-2111 
Subject: Re: Using the command line tool to edit 
Stefan Ritt wrote:

I fixed two things:

  • The logbook can now contain a space. Enclose it in double quotes such as elog -l "LOG BOOK" ...
  • The error you report comes from the fact that you are the first person using elog submissions together with "use lock=1" in the configuration file. This has never been tested and therefore does not work . So I fixed this by adding a new hidden parameter. If you update to SVN revision 2122, things should work

Tehe, leave it to us "stupid users" to break your nice little program in new and exiting ways... ;-) But: THANK YOU! Both things are indeed working now - that brings me one step closes to my automated logbook, which is great!

 

Stefan Ritt wrote:

Concerning your request of editing existing entries by their idea, I agree with Yoshi that you could grab the ID upon the first submission. An alternative is to make a direct search on a logbook. Since this is not implemented in the elog command line tool, you have to use wget for it:

wget "http://localhost:8080/LOGBOOK/?mode=raw&Attribute1=something" -O elog.txt

A problem here is that the username and password are normally transmitted in an encrypted form as cookies by your browser after you logged in. Now you have to convince wget first to log in like

wget "http://localhost:8080/LOGBOOK/?unamee=USER&upassword=PASSWD"--save-cookies cookies.txt

followed by a second call to wget with --load-cookies cookies.txt. I tried that but was not successful since the login procedure above redirects to the elog listing page, and only the cookies set after the redirection were saved in cookies.txt. Maybe you can figure out how to do that. The only way I could get it to work is to supply the encoded password, which I manually obtained from the password file. The URL was then

wget "http://localhost:8080/LOGBOOK/?mode=raw&Attribute1=something&unm=USER&upwd=ENC_PWD" -O elog.txt

I thought about grabbing the ID on first creation. The problem with that is that I really would have to run parallel "databases" - one in elog to keep the information I want plus a second one which maps the elog-IDs to the "real" IDs - and the second one would also have to deal with things like "ID exists", "ID doesn't exist", "ID gets deleted" and so on - just the kind of hassle I want to avoid. But what you suggest with wget will most likely be sufficient. The logbook in question is readable for everyone (only editing/writing requires authentication), so I can search without password hassle. In fact, this will work:

 

wget -q "http://localhost:8080/LOGBOOK/?mode=raw&Attribute1=something" -O -| grep '\$@MID'|awk '{print $2}'

Et voila, I have an ID. This will generate a bit more traffic than a parallel "DB", but I think it will be less susceptible to errors, as all information is kept within the elog logbook at all times. Thanks again for your help - time to do some scripting! :-)

ELOG V3.1.5-3fb85fa6