|
| 1 | +--- |
| 2 | +title: The persist-tool manual page |
| 3 | +id: adm-man-persist-tool |
| 4 | +description: >- |
| 5 | + persist-tool --- {{ site.product.short_name }} configuration file |
| 6 | +--- |
| 7 | + |
| 8 | +## Synopsis |
| 9 | + |
| 10 | +persist-tool [command] [options] |
| 11 | + |
| 12 | +## Description |
| 13 | + |
| 14 | +This manual page is only an abstract. |
| 15 | + |
| 16 | +The persist-tool application is a utility that can be used to dump the content of the persist file, and manipulate its content. |
| 17 | + |
| 18 | + |
| 19 | +**CAUTION:** Persist-tool is a special tool for syslog-ng experts. Do use the tool unless you know exactly what you are doing. Misconfiguring it will result in irrecoverable damage to the persist file, without any warning. |
| 20 | +{: .notice--danger} |
| 21 | + |
| 22 | +Limitations: |
| 23 | +* The persist-state functions can be used only with `SLP4` or newer persist files. Older persist files are not supported. |
| 24 | +* Wildcard characters are not supported in file and directory names. |
| 25 | + |
| 26 | +## The dump command |
| 27 | + |
| 28 | +dump [options] [persist_file] |
| 29 | + |
| 30 | +Use the `dump` command to print the current content of the persist file in JSON format to the console. |
| 31 | + |
| 32 | +The `dump` command has the following options: |
| 33 | +* `--help` or `-?` |
| 34 | + |
| 35 | + Display a brief help message. |
| 36 | + |
| 37 | +### Example: persist-tool dump |
| 38 | + |
| 39 | +```config |
| 40 | +persist-tool dump /opt/syslog-ng/var/syslog-ng.persist |
| 41 | +``` |
| 42 | + |
| 43 | +A valid output is the following: |
| 44 | + |
| 45 | +```config |
| 46 | +run_id = { "value": "00 00 00 00 0C 00 00 00 " } |
| 47 | +host_id = { "value": "00 00 00 00 5F 49 2F 01 " } |
| 48 | +``` |
| 49 | + |
| 50 | +## The add command |
| 51 | + |
| 52 | +add [options] [input_file] |
| 53 | + |
| 54 | +Use the `add` command to add or modify a specified state-entry in the persist file. The state-entry should be in the same format as the `dump` command displays it. If the given state-entry already exists, it will be updated. Otherwise, a new value will be added. If the given persist state is invalid, it will be skipped. |
| 55 | + |
| 56 | +To use the `add` command: use `persist-tool dump` to print the content of the current persist file, and redirect it to a file. Edit the content of this file. Use `persist-tool` add with this file to modify the persist. |
| 57 | + |
| 58 | +The `add` command has the following options: |
| 59 | +* `--help` or `-?` |
| 60 | + |
| 61 | + Display a brief help message. |
| 62 | +* `--output-dir=<directory>` or `-o` |
| 63 | + |
| 64 | + Required parameter. The directory where the persist file is located at. The name of the persist file stored in this directory must be syslog-ng.persist. |
| 65 | +* `--persist-name=<filename>` or `-p` |
| 66 | + |
| 67 | + Optional parameter. The name of the persist file to generate. Default value: syslog-ng.persist. |
| 68 | + |
| 69 | +### Example: add dump_persist |
| 70 | + |
| 71 | +```config |
| 72 | +/opt/syslog-ng/bin/persist-tool add dump_persist -o . |
| 73 | +``` |
| 74 | + |
| 75 | +A valid output is the following: |
| 76 | + |
| 77 | +```config |
| 78 | +log_reader_curpos(Application) OK |
| 79 | +affile_sd_curpos(/var/aaa.txt) OK |
| 80 | +``` |
| 81 | + |
| 82 | +An invalid output is the following: |
| 83 | + |
| 84 | +```config |
| 85 | +log_reader_curpos(Application) OK |
| 86 | +wrong |
| 87 | +FAILED (error: Invalid entry syntax) |
| 88 | +affile_sd_curpos(/var/aaa.txt) OK |
| 89 | +``` |
| 90 | + |
| 91 | +## Files |
| 92 | + |
| 93 | +/opt/syslog-ng/bin/persist-tool |
| 94 | + |
| 95 | +## See also |
| 96 | + |
| 97 | +The syslog-ng.conf manual page |
| 98 | + |
| 99 | +The syslog-ng OSE manual page |
0 commit comments