|
| 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 | +**NOTE:** |
| 23 | +Limitations: |
| 24 | +* The persist-state functions can be used only with `SLP4` or newer persist files. Older persist files are not supported. |
| 25 | +* Wildcard characters are not supported in file and directory names. |
| 26 | + |
| 27 | +{: .notice--info} |
| 28 | + |
| 29 | +## The dump command |
| 30 | + |
| 31 | +dump [options] [persist_file] |
| 32 | + |
| 33 | +Use the `dump` command to print the current content of the persist file in JSON format to the console. |
| 34 | + |
| 35 | +The `dump` command has the following options: |
| 36 | +* `--help` or `-?` |
| 37 | +Display a brief help message. |
| 38 | + |
| 39 | +### Example: persist-tool dump |
| 40 | + |
| 41 | +```config |
| 42 | +persist-tool dump /opt/syslog-ng/var/syslog-ng.persist |
| 43 | +``` |
| 44 | + |
| 45 | +A valid output is the following: |
| 46 | + |
| 47 | +```config |
| 48 | +run_id = { "value": "00 00 00 00 0C 00 00 00 " } |
| 49 | +host_id = { "value": "00 00 00 00 5F 49 2F 01 " } |
| 50 | +``` |
| 51 | + |
| 52 | +## The add command |
| 53 | + |
| 54 | +add [options] [input_file] |
| 55 | + |
| 56 | +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. |
| 57 | + |
| 58 | +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. |
| 59 | + |
| 60 | +The `add` command has the following options: |
| 61 | +* `--help` or `-?` |
| 62 | +Display a brief help message. |
| 63 | +* `--output-dir=<directory>` or `-o` |
| 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 | +Optional parameter. The name of the persist file to generate. Default value: syslog-ng.persist. |
| 67 | + |
| 68 | +### Example: add dump_persist |
| 69 | + |
| 70 | +```config |
| 71 | +/opt/syslog-ng/bin/persist-tool add dump_persist -o . |
| 72 | +``` |
| 73 | + |
| 74 | +A valid output is the following: |
| 75 | + |
| 76 | +```config |
| 77 | +log_reader_curpos(Application) OK |
| 78 | +affile_sd_curpos(/var/aaa.txt) OK |
| 79 | +``` |
| 80 | + |
| 81 | +An invalid output is the following: |
| 82 | + |
| 83 | +```config |
| 84 | +log_reader_curpos(Application) OK |
| 85 | +wrong |
| 86 | +FAILED (error: Invalid entry syntax) |
| 87 | +affile_sd_curpos(/var/aaa.txt) OK |
| 88 | +``` |
| 89 | + |
| 90 | +## Files |
| 91 | + |
| 92 | +/opt/syslog-ng/bin/persist-tool |
| 93 | + |
| 94 | +## See also |
| 95 | + |
| 96 | +The syslog-ng.conf manual page |
| 97 | + |
| 98 | +The syslog-ng manual page |
0 commit comments