@@ -682,6 +682,60 @@ func (r LoggingReceiverSystemd) Components(ctx context.Context, tag string) []fl
682
682
return input
683
683
}
684
684
685
+ func (r LoggingReceiverSystemd ) Pipelines (ctx context.Context ) ([]otel.ReceiverPipeline , error ) {
686
+ receiver_config := map [string ]any {
687
+ "start_at" : "beginning" ,
688
+ "priority" : "debug" ,
689
+ }
690
+
691
+ modify_fields_processors , err := LoggingProcessorModifyFields {
692
+ Fields : map [string ]* ModifyField {
693
+ `severity` : {
694
+ CopyFrom : "jsonPayload.PRIORITY" ,
695
+ MapValues : map [string ]string {
696
+ "7" : "DEBUG" ,
697
+ "6" : "INFO" ,
698
+ "5" : "NOTICE" ,
699
+ "4" : "WARNING" ,
700
+ "3" : "ERROR" ,
701
+ "2" : "CRITICAL" ,
702
+ "1" : "ALERT" ,
703
+ "0" : "EMERGENCY" ,
704
+ },
705
+ MapValuesExclusive : true ,
706
+ },
707
+ `sourceLocation.file` : {
708
+ CopyFrom : "jsonPayload.CODE_FILE" ,
709
+ },
710
+ `sourceLocation.func` : {
711
+ CopyFrom : "jsonPayload.CODE_FUNC" ,
712
+ },
713
+ `sourceLocation.line` : {
714
+ CopyFrom : "jsonPayload.CODE_LINE" ,
715
+ Type : "integer" ,
716
+ },
717
+ },
718
+ }.Processors (ctx )
719
+
720
+ if err != nil {
721
+ return nil , err
722
+ }
723
+
724
+ return []otel.ReceiverPipeline {{
725
+ Receiver : otel.Component {
726
+ Type : "journald" ,
727
+ Config : receiver_config ,
728
+ },
729
+ Processors : map [string ][]otel.Component {
730
+ "logs" : modify_fields_processors ,
731
+ },
732
+
733
+ ExporterTypes : map [string ]otel.ExporterType {
734
+ "logs" : otel .OTel ,
735
+ },
736
+ }}, nil
737
+ }
738
+
685
739
func init () {
686
740
LoggingReceiverTypes .RegisterType (func () LoggingReceiver { return & LoggingReceiverSystemd {} }, platform .Linux )
687
741
}
0 commit comments