## 4 Results of the Software-Prototyping
### From Logging to Structured Logging
Each event and child events of this stream are assigned a set of key-value pairs:

* general=\"value\"
* tag=\"foo\"
* service_mark=\"test\"

These log-stream-specific key-value pairs can be used to define selection criteria in analytical databases like ElasticSearch to filter events of a specific service only. The following lines of code demonstrate how to create a parent event and child events, see Listing 2. ```
#Logeventsusingthewithclause
2 withlog.event(''Test'',hello=''World'')asevent:
3 event.update(test=''something'')
4#addseventspecifickeyvaluepairstothe~event
5 withevent.child(''Subevent1 ofTest'')asev:
6 ev.update(foo=''bar'')
7 ev.error(''Catastrophe'')
8#Eplicitcalloflog(hereonerrorlevel)
9 withevent.child(''Subevent2 ofTest'')asev:
10 ev.update(bar=''foo'')
11#Implicitcallofev.info(''Success'')(atblockend)
12
13 withevent.child(''Subevent3 ofTest'')asev:
14 ev.update(bar=''foo'')
15#Implicitcallofev.info(''Success'')(atblockend)
```

**Listing 2** Event logging in log12 using blocks as structure. Furthermore, it is possible to log events in the event stream without the block style, see Listing 3. That might be necessary for programming languages that do not support closing resources (here a log stream) at the end of a block. In this case, programmers are responsible for closing events using the **.info0**, **.warn0**, **.error0** log levels. ```
1#Tologeventswithoutwith-blocksispossibleaswell. ev=log.event(\"Anothertest\",foo=\"bar\") ev.update(bar=\"foo\") child=ev.child(\"SubeventofAnothertest\",foo=\"bar\") ev.info(\"Finished\") #<=However,than\"yoursareareresponsibletogeventsexplicitly
#Ifparenteventsareloggedallsubsequentchildrenevents #areassumedtohavclosedsuccessfullyaswell
```

Listing 3: Event logging in log12 without blocks. Using this type of logging to forward events along Hypertext Transfer Protocol (HTTP) requests is also possible. This usage of HTTP-Headers is the usual method in distributed tracing. Two main capabilities are required for this [25]. First, extracting header information received by an HTTP service process must be possible. Secondly, it must be possible to inject the tracing information in follow-up upstream HTTP requests (in particular, the trace ID and span ID of the process initiating the request). Listing 4 shows how **log12** supports this with an extract attribute at event creation and an inject method of the event that extracts relevant key-value pairs from the event so that they can be passed as header information along an HTTP request. ```
importlog12 importrequests#TogenerateHTTPrequests fromflaskimportrequest#TodemonstrateHeader-extraction
```
1 withlog.event(\"Distributedtracing\",extract=request.headers)asev:
2#Hereishowtopasstracinginformationalongreontecalls withev.child(\"Task1\")asevent: response=requests.get(\"[[https://qr.mylab.th-luebeck.dev/route?url=https://google.com](https://qr.mylab.th-luebeck.dev/route?url=https://google.com)]([https://qr.mylab.th-luebeck.dev/route?url=https://google.com](https://qr.mylab.th-luebeck.dev/route?url=https://google.com))\",headers=event.inject() ) event.update(length=len(response.text),status=response. status_code) ```

Listing 4: Extraction and injection of tracing headers in log12. ## 5 Evaluation of the Logging Prototype

The study evaluated the software prototype in the defined use cases to determine its suitability for capturing qualitative events, quantitative metrics, and traces in distributed systems. The evaluation also performed long-term recordings of high-volume event streams in the sense of stress tests:

* The study designed the use cases 1 and 2 mainly to evaluate the instrumentation of qualitative system events;
* Use case 3 was primarily used to capture quantitative metrics that often occur in IT infrastructures or platforms and are essential to multi-level observability;
* Use case 4 was used to monitor systems that were intentionally not under the direct control of the researchers and, therefore, could not be instrumented directly.