Comments (11)
Very weird, what you're saying is that the message is getting into Elastic but without any custom values?
Do you see any error message or any other indication?
Because I have added a specific test for custom values and I won't submit this version if the test wasn't pass...
I hope I could test this soon with your config.
Please update if you have more insights.
Regards
from log4stash.
I can't repro this on my local machine.
Do you still get the count: 0
in you json or you get something else now?
Please check again that you are using the correct version and see if you can find any error message.
from log4stash.
I can't get custom properties to work either. I set them with GlobalContext.Properties["Guid"] and use %property{Guid} to access them. This works fine in fileappender but not in ElasticSearchAppender.
I get this in ES: "Guid": {}
Do I have to set something up in the config for these custom properties?
All I have is this:
<appender name="ElasticSearchAppender" type="log4stash.ElasticSearchAppender, log4stash">
<Server>localhost</Server>
<Port>9200</Port>
<IndexName>logstash-%{+yyyyMM}</IndexName>
<IndexType>log</IndexType>
<IndexAsync>true</IndexAsync>
</appender>
from log4stash.
Hi @jonhb and @Dima234 ,
Please try this pre release:
https://www.nuget.org/packages/log4stash/2.0.2-pre
Let me know if it fixed your issue.
Thanks
from log4stash.
Hi,
I still can't get it to work.
from log4stash.
emmm... let's try another thing,
try to put:
<FixedFields>Partial</FixedFields>
inside your configuration file.
(so it will be:
<appender name="ElasticSearchAppender" type="log4stash.ElasticSearchAppender, log4stash">
<Server>localhost</Server>
<Port>9200</Port>
<IndexName>logstash-%{+yyyyMM}</IndexName>
<IndexType>log</IndexType>
<IndexAsync>true</IndexAsync>
<FixedFields>Partial</FixedFields>
</appender>
And furthermore, I noticed that you said you
use %property{Guid} to access them
Where do you use it?
Hope the FixedFields
will make it work.
Cheers
from log4stash.
Hi,
I use it where I define the output pattern for the RollingFileAppender (and also where i define parameters for the SQL server appender):
`
`This outputs the Guid correctly in the file. In the code I set the Guid through a provider class where I have overridden the ToString method to return the Guid variable.
This is only initialized once:
log4net.GlobalContext.Properties["Guid"] = new GuidProvider();
and then this returns the dynamic Guid:
public class GuidProvider { public override string ToString() { return Guid; } }
The FixedFields does not help anything unfortunatly.
from log4stash.
Thanks, I'm pretty sure I found the problem.
Will update you soon with new version.
Note that your problem is different from the author of this thread that is why I got a bit confused at first.
from log4stash.
Forgot to ask, Is there a reason you don't call toString inline?
like this:
log4net.GlobalContext.Properties["Guid"] = new GuidProvider().toString();
from log4stash.
I don't think that will work.
from log4stash.
Please use this version
https://www.nuget.org/packages/log4stash/2.0.2-b
@jonhb, Add this to your configuration :
<ElasticFilters>
<Convert>
<ToString>Guid</ToString>
</Convert>
</ElasticFilters>
This will cause calling the ToString()
function before indexing into ElasticSearch.
@Dima234, Add this to your configuration:
<ElasticFilters>
<Convert>
<ToString>UserName</ToString>
<ToArray>
<SourceKey>UserName</SourceKey>
</ToArray>
</Convert>
</ElasticFilters>
This will cause calling ToString()
of the stack object and then convert the values to array.
If you both already have ElasticFilters
just add the Convert
into it.
And please open new issue if the problem still occurs.
All the best,
Uriel
from log4stash.
Related Issues (20)
- Nuget package not working: Basic reproduceable example
- Using the template returns not data HOT 1
- Custom log4net values get submitted as { "Count": 1 } HOT 2
- Does not work with log4net 2.0.8 or higher HOT 5
- Unable to push logs to https elasticsearch from aspnet core HOT 3
- ConvertToArrayFilter: System.ArgumentNullException: Value cannot be null HOT 10
- Not clear what these properties do HOT 1
- log4stash v3.0.0 doesn't work with ElasticSearch 6.x HOT 1
- Log4Stash logging metadata info by itself HOT 2
- AWS Signature failure - Incorrect HOST header? HOT 1
- log4stash does not have Http compression for ES?
- Target Elasticsearch index is incorrect HOT 3
- Authentication configuration does not feel compatible with "log4net >= 2.0.8" HOT 2
- log4stach elastic search appender memory leak HOT 4
- Allowing self signed certs does not work (AllowSelfSignedServerCert) HOT 1
- Unobserved task exception in ASP.NET Web API project when using IndexAsync and BulkSize is reached during request
- In PrepareBulk: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
- Can't set authentication method v3.0.4 HOT 4
- IndexOperationParams from example is not working HOT 1
- How to use it on .Net 6? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from log4stash.