If you use the Splunk data store as your central log repository, the data will not be stored in the original format. If you need to reconstitute your log files (e.g. for compliance, audit, etc.) you will want to export your event data.
Export event dataFrom the Splunk CLI, use the export command. To use Splunk's CLI, navigate to the $SPLUNK_HOME/bin/ directory and use the ./splunk command. You can also add Splunk to your path and use the splunk command.
The terms argument is used to search the index and collect the data that should be reconstituted. The terms cannot include complex searches (NOT, maxevents, extracted fields, etc.).
Example:
# splunk export eventdata main -dir /usr/auser/exported_events
This command will create directories under the specified destination corresponding to the the source directories of the requested events, containing files named by source. The exported data is the raw event text. If the original source was a network port, it will be named for the source port. To export subsets of data, append -host <hostname> or -terms "my event search terms" to the command.
CLI searchYou can also export events by doing a CLI search and redirecting the output to a file.
# splunk search "source::/var/log/asl.log" > asl.log
Comments
No comments have been submitted.