Skip to content

Commit ef3b5cd

Browse files
authored
Add Scan Data Log documentation
Document how the scan log data is stored
1 parent 9a9d761 commit ef3b5cd

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Scan Data Log
2+
=============
3+
4+
The `Log` command to log samples and the associated `scan/{id}/data` REST interface to fetch logged data
5+
are based on an Apache Derby database.
6+
It is stored in the `<data_log>` folder provided in the `scan_config.xml`,
7+
with the example value of `/tmp/scan_log_db`.
8+
9+
It’s a relational database. To access the RDB, the Derby “ij” command line tool is included in the scan server.
10+
In addition to the Derby jar files, the scan server jar is required because the scan sample "value"
11+
is stored as a serialized `org.csstudio.scan.server.log.derby.SampleValue`.
12+
13+
Example for starting "ij" and accessing the basic tables:
14+
15+
```
16+
$ cd scan-server/lib
17+
$ java -Dderby.system.home=/tmp/scan_log_db \
18+
-cp "service-scan-server-4.7.4-SNAPSHOT.jar:lib/derby-10.16.1.1.jar:lib/derbyshared-10.16.1.1.jar:lib/derbytools-10.16.1.1.jar” \
19+
org.apache.derby.impl.tools.ij.Main
20+
ij version 10.16
21+
ij> CONNECT 'jdbc:derby:scan';
22+
ij> SELECT * FROM scans;
23+
ID |NAME |CREATED
24+
---------------------------------------
25+
1 |Example |2025-10-31 11:22:55.760598
26+
27+
ij> SELECT * FROM devices;
28+
ID |NAME
29+
---------------
30+
1 |loc://x(0)
31+
32+
ij> SELECT * FROM scans;
33+
ID |NAME |CREATED
34+
---------------------------------------------
35+
1 |Example |2025-10-31 11:22:55.760598
36+
37+
ij> SELECT * from samples;
38+
SCAN_ID|DEVICE_ID |SERIAL |TIMESTAMP |VALUE
39+
-------------------------------------------------------------
40+
1 |1 |0 |2025-10-31 11:22:55.82952 |1.0
41+
```
42+
43+
Joining the tables together as is tradition with RDBs:
44+
45+
```
46+
ij> SELECT c.name, s.serial, s.timestamp, d.name, s.value
47+
FROM samples s
48+
JOIN scans c on c.ID = s.SCAN_ID
49+
JOIN devices d ON d.ID = s.DEVICE_ID
50+
ORDER BY c.name, s.serial;
51+
52+
NAME |SERIAL |TIMESTAMP |NAME |VALUE
53+
-----------------------------------------------------------------------
54+
Example |0 |2025-10-31 11:22:55.82952 |loc://x(0) |1.0
55+
```

0 commit comments

Comments
 (0)