Collect files from an SFTP server
This page explains how to collect log files from a directory on an SFTP server. The appliance connects on a schedule, reads each new file, and turns every line into an event.
Role needed: a user with the Admin or Super Admin account type. A user with a custom role needs Settings access and, under Collection & Automation, Log Onboarding with Set.
How files are read
- The appliance lists the files in the directory you name. It does not read subdirectories.
- It sorts the files by name and reads only files whose name sorts after the last file it processed. Name files so that newer files sort later, for example with a date and time at the start of the name.
- A file is read once, whole. Lines appended to a file after it was read are not collected, and a file whose name sorts before the last processed file is skipped.
- Each non-empty line becomes one event. The line is stored as the event's message together with the file name and path. No fields are extracted from the line.
Before you begin
- The appliance must be able to reach the server, on port 22 by default.
- Create an account with read access to the directory, and store it under Credential Vault. See Onboard a data source.
Add an SFTP source
- Select Settings, then Log Onboarding under Collection & Automation, then select the + button.
- Choose
sftpunder Log source type. - Under Credential, choose the saved credential. SFTP signs in with the credential's user name and password.
- Enter the Host and Port (22 by default) and the Path of the directory.
- Set Poll Interval (seconds). The default is 300.
- Select Check connection, which tests that the host and port accept a connection.
- Enter a Log source name, then select Save.
Confirm that events arrive
After the first poll interval the source moves from Pending to Active in Log Onboarding. See Check that a source is sending. If it stays Pending, see Events are not arriving.