Skip to content

Commit 21a8eb1

Browse files
[extension/storage/filestorage] Document how to read files created by the file_storage extension (#32180)
**Description:** This PR adds documentation explaining how to read the contents of files created by the `file_storage` extension. **Link to tracking Issue:** * Related to #30970 * Follow up to #31886 (comment) --------- Co-authored-by: Tiffany Hrabusa <[email protected]>
1 parent 3deea1b commit 21a8eb1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

extension/storage/filestorage/README.md

+29
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,32 @@ The schedule for this feature gate is:
133133
- Removed in v0.102.0 (three releases after `stable`).
134134

135135
[unicode_chars]: https://en.wikipedia.org/wiki/List_of_Unicode_characters
136+
137+
## Troubleshooting
138+
139+
_Currently, the File Storage extension uses [bbolt](https://github.com/etcd-io/bbolt) to store and read data on disk. The
140+
following troubleshooting method works for bbolt-managed files. As such, there is no guarantee that this method will continue to work in the future, particularly if the extension switches away from bbolt._
141+
142+
When troubleshooting components that use the File Storage extension, it is sometimes helpful to read the raw contents of
143+
files created by the extension for the component. The simplest way to read files
144+
created by the File Storage extension is to use the strings utility ([Linux](https://linux.die.net/man/1/strings),
145+
[Windows](https://learn.microsoft.com/en-us/sysinternals/downloads/strings)).
146+
147+
For example, here are the contents of the file created by the File Storage extension when it's configured as the storage
148+
for the `filelog` receiver.
149+
150+
```sh
151+
$ strings /tmp/otelcol/file_storage/filelogreceiver/receiver_filelog_
152+
default
153+
file_input.knownFiles2
154+
{"Fingerprint":{"first_bytes":"MzEwNzkKMjE5Cg=="},"Offset":10,"FileAttributes":{"log.file.name":"1.log"},"HeaderFinalized":false,"FlushState":{"LastDataChange":"2024-03-20T18:16:18.164331-07:00","LastDataLength":0}}
155+
{"Fingerprint":{"first_bytes":"MjQ0MDMK"},"Offset":6,"FileAttributes":{"log.file.name":"2.log"},"HeaderFinalized":false,"FlushState":{"LastDataChange":"2024-03-20T18:16:39.96429-07:00","LastDataLength":0}}
156+
default
157+
file_input.knownFiles2
158+
{"Fingerprint":{"first_bytes":"MzEwNzkKMjE5Cg=="},"Offset":10,"FileAttributes":{"log.file.name":"1.log"},"HeaderFinalized":false,"FlushState":{"LastDataChange":"2024-03-20T18:16:18.164331-07:00","LastDataLength":0}}
159+
{"Fingerprint":{"first_bytes":"MjQ0MDMK"},"Offset":6,"FileAttributes":{"log.file.name":"2.log"},"HeaderFinalized":false,"FlushState":{"LastDataChange":"2024-03-20T18:16:39.96429-07:00","LastDataLength":0}}
160+
default
161+
file_input.knownFiles2
162+
{"Fingerprint":{"first_bytes":"MzEwNzkKMjE5Cg=="},"Offset":10,"FileAttributes":{"log.file.name":"1.log"},"HeaderFinalized":false,"FlushState":{"LastDataChange":"2024-03-20T18:16:18.164331-07:00","LastDataLength":0}}
163+
{"Fingerprint":{"first_bytes":"MjQ0MDMK"},"Offset":6,"FileAttributes":{"log.file.name":"2.log"},"HeaderFinalized":false,"FlushState":{"LastDataChange":"2024-03-20T18:16:39.96429-07:00","LastDataLength":0}}
164+
```

0 commit comments

Comments
 (0)