I'm trying to read log files from a network share on Windows. I know this isn't best practice, but currently there is no way around it, and from the documentation it sounds like it is supported.
However I can not get this working. In the trace log I always get that 0 files are found.
[2022-12-13T10:23:52,832][TRACE][filewatch.discoverer ][main][e67bc34fb15be8fb610b8ac1ec20f025b05bf85e339b9399c18f5e5b87a23c75] discover_files {:count=>0}
I have tried the following in the config file:
input {
file {
path =>
[
"W:/application1/test.log", #mapped network drive
"W:\application1\test.log", #mapped network drive
"\\server1\logs\application1\test.log",
"\\server1/logs/application1/test.log",
]
}
}
Any ideas, suggestions?
I have noticed there are a couple of topics on this issue, but none of them have an answer:
Hi Everyone,
I'm having issue to get Logstash to send logs from Windows network drive while running it as Windows Service (using NSSM), it works perfectly fine using the CLI.
Here's the logstash.conf:
input {
file {
path => "c:/sample.log"
path => "c:/networklog/sample.log"
path => "//sample-test-winvm-002/networkdrive/location1/sample.log"
# path => "//10.0.0.22/networkdrive/location1/sample.log"
# path => "z:/location1/sample.log"
}
}
From the debug logs, I can see the fol…
Hello,
I tried specifying a UNC-Path for the "path"-Setting of the logstash file input plugin and unfortunately it doesn't work.
Is this a known issue or does someone here know how to get this to work on a windows maschine?
Here's what I've tried so far:
path => ["\\PC-NAME\share\file.txt"]
path => ["\\\\PC-NAME\\share\\file.txt"]
path => ["\\\\\\\\PC-NAME\\\\share\\\\file.txt"]
path => ["PC-NAME\share\file.txt"]
path => ["PC-NAME/share/file.txt"]
path => ["/PC-NAME/share/file.txt"]
path => …
Thank you
simon137
(Simon)
December 13, 2022, 10:30am
2
I think it simply just doesn't work.. even though the docs say it should work.
At least I couldn't get it to work. I even filed a bug report on github for the file-input plugin, but it hasn't received any attention so far.
opened 02:11PM - 18 Oct 22 UTC
bug
**Logstash information**:
Please include the following information:
1. Log… stash version: 8.4.3
2. Logstash installation source: extracted from the official zip archive
3. How is Logstash being run: windows service
4. How was the Logstash Plugin installed: plugin was not installed seperately
**JVM** (e.g. `java -version`): Bundled JDK: OpenJDK 64-Bit Server VM 17.0.4+8 on 17.0.4+8 +indy +jit [x86_64-mswin32]
**OS version** (`uname -a` if on a Unix-like system): Windows 10
**Description of the problem including expected versus actual behavior**:
Specifying a UNC-Path (windows network share) for the "path"-Setting of the logstash file input plugin doesn't work. In most of the cases the pipeline just starts and does nothing, in a few cases an error is thrown, that absolute paths are not allowed, which makes sense, but I wanted to try anyway
Here's what I've tried so far:
path => ["\\PC-NAME\share\file.txt"]
path => ["\\\\PC-NAME\\share\\file.txt"]
path => ["\\\\\\\\PC-NAME\\\\share\\\\file.txt"]
path => ["PC-NAME\share\file.txt"]
path => ["PC-NAME/share/file.txt"]
path => ["/PC-NAME/share/file.txt"]
path => ["//PC-NAME/share/file.txt"]
path => ["////PC-NAME//share//file.txt"]
path => ["file://///PC-NAME/share/file.txt"]
The last one works on windows also in the browser for example.
**Steps to reproduce**:
Just specify a UNC-Path in the path-setting of the file-input plugin with an empty filter and output to elasticsearch or stdout to check if it reads the file. It works perfetly for local paths like this: `C:/share/file.txt` but not for UNC-Paths.
see also here: [https://discuss.elastic.co/t/how-to-specify-an-unc-path-network-share-for-logstash-file-input-plugin/316900)](https://discuss.elastic.co/t/how-to-specify-an-unc-path-network-share-for-logstash-file-input-plugin/316900)
That's sad to hear, I hope somebody can give some clarity on this issue. What did you end up doing as an alternative?
simon137
(Simon)
December 13, 2022, 1:44pm
4
We eventually just decided to use another technology for the specific use case the pipeline was initially set up to handle. We ended up writing a program in C# to replace the logstash pipeline.
1 Like
Rios
(Rios)
December 14, 2022, 7:05am
5
Only this could work: "W:/application1/test.log"
Writing C#? You can make a script to tail© log on the local drive.
1 Like
system
(system)
Closed
January 11, 2023, 7:05am
6
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.